
Written February 6, 2008. Tagged Ruby.
I generalized bypassing attr_accessible and attr_protected for test factories.
The new version is a plugin and can be used outside tests as well. It supports unprotected versions of create, create! and new. ActiveRecord::Base gets a with_unprotected_attributes class method. Pass it a block and anything inside will be done with unprotected attributes.
Get it here (highlighted source).
Save that file as vendor/plugins/with_unprotected_attributes/init.rb, or stick it in environment.rb, or put it in a file in lib and require it.