Ruby on Rails
Sunday, February 4, 2018
In a has_many_through association where both records exist how do I create a new association
-- In this case Person has_many_pictures through person_picture and I'm trying to add an existing picture to an existing person like this:
@person.pictures << @picture
But this creates a new picture instead of adding the association
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/741e9a16-483f-4fc6-a2e7-77706b9b250c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment