You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a Parrot model, and it's got a polymorphic association with Pirate and Landlubber.
I want to deep clone a Pirate's Parrots and associate them with the Landlubber. I did something similar for a non-polymorphic model, and that worked great (Basically this #109)
When you deep clone an association, it sets the association (pirate parrots) as well as the inverse association (parrot parrotable). I think rails sets the parrotable_type when the duped record is associated. There is no id as the pirate is a new record.
Does it really matter in this case? As you want to associate LandLubber afterwards, I guess you could do the same thing (set the inverse)? Something like:
Let's say I have a Parrot model, and it's got a polymorphic association with Pirate and Landlubber.
I want to deep clone a Pirate's Parrots and associate them with the Landlubber. I did something similar for a non-polymorphic model, and that worked great (Basically this #109)
So I do
I'm ending up with
parrotable_type
is not cleared, butparrotable_id
is cleared.Is this working as intended?
The text was updated successfully, but these errors were encountered: