Is this your first visit? You may want to subscribe to the feed.

Fix for acts_as_audited and attr_accessible

The biggest complaint I get about acts_as_audited is finally fixed: if you want to use acts_as_audited on a model that uses attr_accessible, you can set the :protect option to false:

class User < ActiveRecord::Base
  acts_as_audited :protect => false
  attr_accessible :name
end

This will prevent acts_as_audited from using attr_protected, which would cause Active Record to raise an error in combination with attr_accessible.

Get the latest code from GitHub

Update: Timothy N. Jones had a good suggestion to automatically disable attr_protected if attr_accessible has already been called. I updated acts_as_audited, so now you only have to set :protect to false if you are declaring attr_accessible after you call acts_as_audited.

Code: acts_as_audited, bug, code, rails Aug 02, 2008 ● updated Oct 14, 2008 0 comments

Speak your mind:

*

*


* I hate spam and will never sell or publish your email address.

(You may use textile in your comments.)

Subscribe

Browse by Tag