Skip to content

Instantly share code, notes, and snippets.

@daviddavis
Created February 11, 2013 20:07
Show Gist options
  • Select an option

  • Save daviddavis/4757174 to your computer and use it in GitHub Desktop.

Select an option

Save daviddavis/4757174 to your computer and use it in GitHub Desktop.
# option 1
info = CustomInfo.new(:keyname => params[:keyname], :value => params[:value])
info.informable = @informable
info.save!
# option 2
CustomInfo.create!(:keyname => params[:keyname],
:value => params[:value],
:informable_type => params[:informable_type],
:informable_id => params[:informable_id]
)
#option 3
@informable.custom_info.create!(:keyname => params[:keyname], :value => params[:value])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment