Red Squirrel Stumblog RSS

Dave Hoover stumbles through technology

Sep
27th
Thu
permalink

Unsettable ActiveRecord::Base attribute

If your ActiveRecord is ignoring your attribute, make sure to check that your model class isn’t restricting which attributes are accessible. Like, say, if you’re using the restful_authentication plugin…

  attr_accessible :login, :email, :password, :pass...
This method is a nice way to lock down which attributes can be changed in an ActiveRecord, but it can be maddening when you’re trying to add a new attribute and you didn’t notice the attr_accessible declaration.