title: how to dynamically add observer methods to an Ember.js object
body: <p>So i am trying to dynamically add these observer methods to a Ember.js object</p>
  
  <pre><code>holderStandoutCheckedChanged: (-&gt;
      if @get("controller.parent.isLoaded")
          @get("controller").toggleParentStandout(@get("standoutHolderChecked"))
  ).observes("standoutHolderChecked")
  
  holderPaddingCheckedChanged: (-&gt;
      if @get("controller.parent.isLoaded")
          @get("controller").toggleParentPadding(@get("holderPaddingChecked"))
  ).observes("holderPaddingChecked")
  
  holderMarginCheckedChanged: (-&gt;
      if @get("controller.parent.isLoaded")
          @get("controller").toggleParentMargin(@get("holderMarginChecked"))
  ).observes("holderMarginChecked")
  </code></pre>
  
  <p>I have this code so far but the item.methodToCall function is not getting called</p>
  
  <pre><code>methodsToDefine = [
      {checkerName: "standoutHolderChecked", methodToCall: "toggleParentStandout"},
      {checkerName: "holderPaddingChecked", methodToCall: "toggleParentPadding"},
      {checkerName: "holderMarginChecked", methodToCall: "toggleParentMargin"}
  ]
  
  add_this = { }
  
  for item in methodsToDefine
      add_this["#{item.checkerName}Changed"] = (-&gt;
          if @get("controller.parent.isLoaded")
              @get("controller")[item.methodToCall](@get(item.checkerName))
      ).observes(item.checkerName)
  
  App.ColumnSetupView.reopen add_this
  </code></pre>
  
  <p>Can anyone tell me what i am doing wrong ?    Is there a better way to do this ?   Should i be doing this in a mixin ?  If so please </p>