Skip to content

Instantly share code, notes, and snippets.

@guinslym
Last active January 3, 2016 00:28
Show Gist options
  • Save guinslym/8382480 to your computer and use it in GitHub Desktop.
Save guinslym/8382480 to your computer and use it in GitHub Desktop.
Rails 3.2.16 I'm having this following error. Can't mass-assign protected attributes
class Profile < ActiveRecord::Base
attr_accessible :birthday, :name, :user_id
#association
belongs_to :user
end
Profile.create(:name => 'John Doe', :password => 'secret', :created_at => Date.today, :updated_at => Date.today)
ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: password, created_at, updated_at
class User < ActiveRecord::Base
attr_accessible :email, :password
#association
has_one :profile
end
@guinslym
Copy link
Author

my model Profile needed to be updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment