On Jun 21, 3:26 pm, Sarah Allen <[email protected]>
wrote:
> We've just upgraded our Rails 2.0.2 app to 2.3 and the webservices
> create APIs are failing. Instead of receiving parsed XML, the
> controller's create method gets the whole xml as a hash key with the
> value nil.
>
> To isolate this issue, I generated a vanilla app:
> $ rails scaffold_xml
> $ ./script/generate scaffold project title:string description:text
> $ rake db:migrate
>
> In real life I test this with cucumber features, but for the purposes of
> short repro steps, I added this to the top of projects_controller.rb
> skip_before_filter :verify_authenticity_token
>
> And then ran the POST for the create request on the command line
> $ curl -X POST -d '<project><title>Awesome</title><description>This is
> an awesome project.</description>'http://localhost:3000/projects.xml
>
I assume this is a typo and than in the real world you had remembered
the closing </project>. Having done that you need to get curl to set
the content type appropriately.
Fred
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <created-at type="datetime">2009-06-21T14:09:08Z</created-at>
> <description nil="true"></description>
> <id type="integer">1</id>
> <title nil="true"></title>
> <updated-at type="datetime">2009-06-21T14:09:08Z</updated-at>
> </project>
>
> The log says:
> Processing ProjectsController#create to xml (for 127.0.0.1 at 2009-06-21
> 07:09:08) [POST]
> Parameters: {"<project><title>Awesome</title><description>This is an
> awesome project.</description>"=>nil}
> Project Create (10.4ms) INSERT INTO "projects" ("updated_at",
> "title", "description", "created_at") VALUES('2009-06-21 14:09:08',
> NULL, NULL, '2009-06-21 14:09:08')
> Completed in 181ms (View: 134, DB: 10) | 201 Created
> [http://localhost/projects.xml]
>
> To test my assumptions, I repeated the above steps with "rails _2.0.2_
> scaffold_xml_202" to look at it in the old version of rails (minus the
> forgery bit which didn't used to be required.) I must be missing
> something basic here. Can anyone enlighten me or point me to relevant
> docs?
>
> Thanks,
> Sarah
> --
> Posted viahttp://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
-~----------~----~----~----~------~----~------~--~---