views:

37

answers:

0

I'd like to use accepts_nested_attributes_for with Active Resource. Is this possible? I have been experimenting in console and passing in nested attributes works, however the nested models fail to create because the foreign_key is never set.

For example,

I have a user class that accepts_nested_attributes_for :credentials. The JSON comes across as

"user" => { "name" => "Joe", "credentials" => ["username" => "joe", "password" => "password"]}

, so I copied that into console, but the credential validation fails since user_id is never set.

Is there a way to do this?