>I would try doing the equivalent on the Rails console, so just loading
> a user object, setting 'user_detail_attributes' attribute, then saving
> and see if that works so any view/controller code can be ruled out.
> Also I think posting the code in the controller's create action would
> be useful. Could possibly be an interaction with attr_accessible so I
> would temporarily disable that to see if it makes a difference.
>
Hi Andrew,
Doesnt work when trying to create via the rails_console, it does work ok
when i do an edit on an exisiting model(details below).
user = User.find(:first)
user.user_detail_attributes = {"website_url" => "www.bbc.co.uk"}
=> {"website_url" => "www.bbc.co.uk"}
user.save
user.user_details
=> expected_object_details......
I commented out attr_accessible and went through the create code again
but still got no user_details saving.
Processing Members::UsersController#create (for 127.0.0.1 at 2009-05-21
20:25:15) [POST]
Parameters:
{"user"=>{"user_detail_attributes"=>{"website_url"=>"www.bbc.co.uk"},
"password_confirmation"=>"xxxxx", "terms"=>"1", "first_name"=>"John",
"password"=>"xxxxxx", "last_name"=>"Butler", "email"=>"[email protected]"},
"commit"=>"Sign up"}
[4;36;1mUser Exists (0.0ms) [0m [0;1mSELECT "users".id FROM
"users" WHERE ("users"."email" = E'[email protected]') LIMIT 1 [0m
[0mINSERT INTO "users" ("salt", "updated_at", "activated_at",
"crypted_password", "vat_number", "title", "user_status_id",
"creator_id", "deleted_at", "remember_token_expires_at",
"activation_code", "role_id", "preferred_currency_id",
"password_reset_code", "reseller_user_id", "updater_id",
"reseller_logo", "remember_token", "terms", "first_name",
"reseller_code", "last_name", "email", "created_at", "state")
VALUES(E'968befce88854acfe386fca4b80aea292b0c5470', '2009-05-21
19:25:15.531000', NULL, E'dd5be536373ce67d3e60b5acc3d2f811330a4062',
NULL, NULL, 2, NULL, NULL, NULL,
E'425574bd1b0d7d81f997f0a8f9b294d23386aee5', 2, NULL, NULL, NULL, NULL,
NULL, NULL, 't', E'John', NULL, E'Butler', E'[email protected]',
'2009-05-21 19:25:15.531000', E'pending') RETURNING "id" [0m
[4;36;1mUser Load (0.0ms) [0m [0;1mSELECT * FROM "users" WHERE
("users"."id" = 981727452) [0m
Sent mail to [email protected]
Im still stuck on this, weird!.
JB
--
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
-~----------~----~----~----~------~----~------~--~---