Skip to content

Instantly share code, notes, and snippets.

@glasner
Created February 22, 2010 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glasner/311492 to your computer and use it in GitHub Desktop.
Save glasner/311492 to your computer and use it in GitHub Desktop.
# in your model
has_many :widgets
accepts_nested_attributes_for :widgets
# @model = Model.new ({:widget_attributes => [{:name => 'one'},{:name => 'two'}] })
# @model.widgets[0].name #=> 'one'
# @model.widgets[1].name #=> 'two'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment