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

Ryan
2008-07-10T17:58:33Z

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:in `attributes=''
    /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:in `update''


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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---