Tuesday, November 29, 2011

Re: [Rails] Re: ActiveRecord::AssociationTypeMismatch

Hi to all,
I think I have understand the problem. When you made a PUT of this type:

<playlist>
<id>7</id>
<name>metal</name>
<images_attributes type="array">
<image>
<id>3</id>
</image>
</images_attributes>
</playlist>

Rails suppose that:

Or your are creating the playlist and the image or you are updating
the relationship inside the playlist, see the method
assign_nested_attributes_for_collection_association in
activerecord-3.0.10/lib/active_record/associations/has_many_through_association.rb

In may case I have already all the image in the play list and I would
create a playlist selecting some images ...

How can I obtain this behavior?

thanks
Gianluca

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate