ruby on rails 4 - Nested form (strong parameters) inserting without values (besides id and timestamps) -


I am creating a restalt API in Rail 4, and a difficult time to send nested form properties for rail There is one association through the database.

I believe my model should be established because they are:

  class users & lt; ActiveRecord :: Base is_on: address, dependent: delete accepts_nested_attributes_for: address and class address & lt; ActiveRecord :: Base is_to: user end  

and in my controller, I have:

  class API :: V1 :: UsersController & lt; API :: V1 :: API Controller Rap _parameters format: [: Jason], includes: [: email, address:] create df @user = user.credit (user_update) @ user.bld_resress @user user render: JSN = & Gt; @ Waiter Other Render: Jason = & gt; {: Errors = & gt; @ User.errors.full_messages} ,: Status = & gt; At the end of 422, private def user_param parameters.require (user:. (Email: address_attributes = & gt; [: id, line1, line2,: city, state, zip]] and end  

When I post the following JSON object ...

  {"email": "test@example.com", "address": {"line1 ":" 99 "," Line 2 ":" "," City ":" New York "," State ":" NY "," Zip ":" 10000 "}}  
P> .. These parameters are being given to the controller:

  parameter: {"email" => "Test@example.com", "address" = & gt; {"Line1" = & gt; ; "New Zealand", "State" = & gt; "NY", "zip" = & gt; "10000"}, "user", "user," "123 Fake St", "line2" => "", "City" = & gt; "= & Gt; {" email "=>" Test@example.com "," address "= & gt; {" line1 "=> 123) "False St.", "Line 2" =>, "City" = & gt; "New York", "State" => "NY", "zip" => "10000"}}}  

And yet, the railroad only incorporates the timestamp and the user_id association in Postgres.

  id | User_id | Line1 | Line2 | City | State | ZIP | Made_at | updated_at -------------------------------------- + ------- --- -------------------------- + ------- + ------- + - --- - + ------- + ----- + ---------------------------- + - -------------------------- f09263ba-2046-446f-b0f3-3030bf3bc23e | 3025d5aa-ed3c-4fac-bae3-24deede59264 || |||| | 2014-07-27 21: 21: 58.945165 | 


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -