开发者

Rails XML - Updating server with multiple records

I'm using a Rails 2.x server, and trying to handle all interaction using XML. I've got no problem with updating the database with single XML records (creating/updating/deleting), but I've got a group of new records I'd like to add in one transaction, and I can't get it to work.

The XML I'm submitting looks like this:

    <invitees>
        <invitee>
            <event>32</event>
            <name>Jack</name>
        </invitee>
        <invitee>
            <event>42</event>
            <name>Alan</name>
        </invitee>
    </invitees>

I'm new to Rails; I can handle the basic Ruby/Rails stuff, but handling this is clearly beyond me! The code to handle this is failing, and I don't understand why. This is what I've got:

  @invitees = params[:invitees]
  for @invitee in @invitees
      thisinvitee = Invitee.new(@invitee)
      thisinvitee.save
      end

This fails in "Invitee.new", with error: NoMethodError (undefined method `stringify_keys!' for #)开发者_如何学JAVA:

Can anyone give me an idea what I'm doing wrong, and how to handle multiple XML records being submitted in a single transaction from a remote client?

Thanks for any help/pointers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜