开发者

Rails Nested Attributes Mass Assignment Error

I have a user model where I cannot create a client due to it being unwri开发者_StackOverflow中文版table in mass assignment.

How do I make it so that I can create a client model?

Code and error are found here: http://pastie.org/1206482


I think you have to add:

attr_accessible :client_attributes

to your user model. client_attributes is the hash in the user hash posted to the create action.

The transmitted hash looks something like this: :user => { :username => "one", ..., :client_attributes => { :name => "client" } }

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜