2 Replies Latest reply on Aug 3, 2006 12:27 PM by clocksarestupid

    Sending Objects to Rails

    clocksarestupid
      Hey guys, first time using Flex. I tried searching google and couldn't find much, so here goes.

      If my DB is like this:

      TABLE: USERS
      ---> first_name (string)
      ---> last_name (string)
      ---> username (string)

      Rails can make it into XML formatted like this:

      User.find(:first).to_xml gives the following:
      <user>
      <first-name>first name</first-name>
      <last-name>last name</last-name>
      <username>username</username>
      </user>

      This is great, but when I try to make a request to create one, i have try this (the vars are from a form):

      <mx:HTTPService contentType="application/xml" id="userCreateRequest" url=" http://localhost:3000/user/create" useProxy="false" method="POST">
      <mx:request xmlns="">
      <review>
      <first-name>{fFirstName.text}</first-name>
      <last-name>{fLastName.text}</last-name>
      <username>{fUsername.text}</username>
      </review>
      </mx:request>
      </mx:HTTPService>

      When I try to compile, I get the following error code:
      1086 Syntax error: expecting semicolon before <mx:request>

      I traced the problem to the dashes in the tags. Is there a way to escape the dashes? I know a workaround is to just change my DB model, but that won't work for relationships (if another table, named events has a USER_ID <user-id>, i could call the user that owned it by @event.user) so I'm hoping for a fill solution.

      Thanks in advance!