Hi,
When you will create the object of model1 at that time you have to
just assign the related records of models2.
For eg.
model1 = Model1.new(...)
model1.model2_ids = [selected object id of model2]
model1.save
It automatically handles the association between currently created
object
of model1 and model2. Then after look at your intermediate table and it
will show the related ids of both the tables.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment