maletor
maletor

Reputation: 7122

Rails Nested Attributes Mass Assignment Error

I have a user model where I cannot create a client due to it being unwritable 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

Upvotes: 0

Views: 1364

Answers (1)

user394592
user394592

Reputation:

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" } }

Upvotes: 4

Related Questions