User.protected_attributes returning empty Set instead of nil -- causing activerecord/lib/base:2307

I have a model that uses attr_accessible, and in my tests I get this:

RuntimeError (Declare either attr_protected or attr_accessible for
User, but not both.):
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
base.rb:2307:in remove_attributes_protected_from_mass_assignment' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:2114:inattributes=’
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
base.rb:2033:in update_attributes' /app/controllers/accounts_controller.rb:50:inupdate’

The model doesnt use attr_protected. It turns out that
User.protected_attributes is returning an empty set instead of nil,
which is what remove_attributes_protected_from_mass_assignment wants.

The real fun part is that this only happens in tests (rake
test:functional or ruby ./user_controller_test.rb). And for a real
kick in the crotch, I’ve seen it in development but only once in about
50 tries.

Anyone ever seen this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs