Ruby on Rails
Wednesday, November 25, 2015
in this example what if i didn't have a values for science, physics and gravity but had to get it from form what field would i use? my guess any of the 3 variables can be substituted with params[:id] ?
Create a root node:
science = Category.create!(:name => 'Science')
Put a new thing inside this root node:
physics = Category.create!(:name => 'Physics') physics.move_to_child_of(science)
Put another thing inside the "physics" node:
gravity = Category.create!(:name => 'Gravity') gravity.move_to_child_of(physics)
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a219650c-e869-4718-86f2-561e824dc1cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment