Hi,

I give up trying. I need to ask this basic question about collections
and hashes.

I'm trying to do a batch update of records using XML:

<?xml version="1.0" encoding="UTF-8"?>
<subscribers>
<subscriber>
  <imei>111</imei>
  <imsi>111</imsi>
  <msidsm>111</msidsm>
  <name>Six</name>
</subscriber>
<subscriber>
  <imei>777</imei>
  <imsi>777</imsi>
  <msidsm>777</msidsm>
  <name>Seven</name>
</subscriber>
</subscribers>

I have this in the routes:

map.resources :subscribers, :collection => {:import => :post}

When I post the XML I get:

Processing SubscribersController#import (for 127.0.0.1 at 2009-09-09
12:18:22) [POST]
  Parameters: {"action"=>"import",
"subscribers"=>{"subscriber"=>[{"name"=>"Six", "msidsm"=>"111",
"imsi"=>"111", "imei"=>"111"}, {"name"=>"Seven", "msidsm"=>"777",
"imsi"=>"777", "imei"=>"777"}]}, "controller"=>"subscribers"}

--------------------------------

How can I easily create subscriber records for those I send in the XML?
I've managed to extract the data but it fails when only one subscriber
element is included in the XML.

What would be the best way to do this?

Thanks.
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to