Skip to content

Instantly share code, notes, and snippets.

@cernalpanic
Created April 26, 2013 14:21
Show Gist options
  • Save cernalpanic/80fa36ebd280f079ae2b to your computer and use it in GitHub Desktop.
Save cernalpanic/80fa36ebd280f079ae2b to your computer and use it in GitHub Desktop.
Everything until line 7 works. I want [context] to be 'appkeys'. #this one works bundle.appkeys << dropped #this one doesn't bundle[context] << dropped I get this error: NoMethodError: undefined method `<<' for #<Bundle:0x007fe7addcca20>
def ajax_add_to_bundle
#params = { bundle_id: 1, droppedid: 1, context: 'appkey' }
bundle = Bundle.find(params[:bundle_id])
context = params[:context]
droppedid = params[:droppedid]
dropped = eval(context).find(droppedid)
bundle[context] << dropped
bundle.save
render :nothing => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment