“WARNING: Can’t mass-assign protected attributes”

Don’t confuse attr_accessor with attr_accessible. Accessor is built into Ruby and defines a getter method – model_instance.foo # returns something – and a setter method – model_instance.foo = 'bar'.

Accessible is defined by Rails and makes the attribute mass-assignable (does the opposite of attr_protected).

If first_name is a field in your model’s database table, then Rails has already defined getters and setters for that attribute. All you need to do is add attr_accessible :first_name.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)