开发者

accepts_nested_attributes_for and Active Resource

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?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜