Ryan
2008-Jul-10 17:58 UTC
User.protected_attributes returning empty Set instead of nil -- causing activerecord/lib/base:2307 to raise
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
-~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- Need help -FATAL: database "catarse_development" does not exist
- Subfolders in Rails applications (newbie)
- Salted Login Error
- Salted hash login generator (verification problem?)
- attr_accessible on some properties + attr_protected on others makes class 'open-by-default'
