I am trying to create a new model from XML that contains has a has_many
relationship. Is this possible without having to write code to parse
the XML or to doing multiple POSTS? I can do a post with XML that
doesn''t contain any of the has_many elements and it works fine. It is
when I add the items from the has_many relationship that I get a bunch
of errors.
Here are the examples I am trying
This works...
<manual-track>
<color>orange</color>
<comment>This is track 3</comment>
<rfi-event-id>RFI 3</rfi-event-id>
<submitter>Joe</submitter>
</manual-track>
This doesn''t
<manual-track>
<color>orange</color>
<comment>This is track 3</comment>
<rfi-event-id>RFI 3</rfi-event-id>
<submitter>Blow</submitter>
<positions>
<position>
<lat type="float">20.0</lat>
<lon type="float">25.0</lon>
</position>
<position>
<lat type="float">30.0</lat>
<lon type="float">35.0</lon>
</position>
</positions>
</manual-track>
Error from cURL about ActiveRecord::AssociationTypeMismatch in Manual
tracksController#create
this fails too...
<manual-track>
<color>orange</color>
<comment>This is track 3</comment>
<rfi-event-id>RFI 3</rfi-event-id>
<submitter>Blow</submitter>
<position>
<lat type="float">20.0</lat>
<lon type="float">25.0</lon>
</position>
<position>
<lat type="float">30.0</lat>
<lon type="float">35.0</lon>
</position>
</manual-track>
NoMethodError in Manual tracksController#create
undefined method `position='' for
#<ManualTrack:0x47ec8dc>
Any suggestions of what I need to do?
Thanks!
CW
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---