0

I'm development an application using Rails 3.1.1 + devise 1.5.0 + simple_form 1.5.2. I need that an user has an address and then I created one class address. The address class is used as a composed_of in user. The problem is that when I post form with data I receive this error message "WARNING: Can't mass-assign protected attributes: address". How do I solve this?

My source code is here: source

Diego Dias
  • 904
  • 3
  • 15
  • 23

1 Answers1

0

Add this to your User model.

attr_accessible :address_attributes

For more information, refer here - attr-accessible-in-rails-active-record

Community
  • 1
  • 1
Jatin Ganhotra
  • 6,825
  • 6
  • 48
  • 71
  • I tried add attr_acessible :address_attributes where attributes is the attributes of address, but no works and then I tried attr_accessible :address and nothing. When I specific :address in attr_accessible explodes this exception "NoMethodError in Devise::RegistrationsController#create undefined method `postal_code' for #" – Diego Dias Feb 24 '12 at 00:34
  • Changed after to https://gist.github.com/1881421 and then I receive this error message "NoMethodError in Devise::RegistrationsController#create undefined method `valid?' for #". What's the problem? – Diego Dias Feb 24 '12 at 01:30