By accident I had Rails-3.1.1 installed by bundler. However, when I discovered this mishap during my feature run I encountered this error in many places: wrong number of arguments (1 for 0) (ArgumentError) /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activemodel-3.1.1/ lib/active_model/mass_assignment_security.rb:209:in `mass_assignment_authorizer'' /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activemodel-3.1.1/ lib/active_model/mass_assignment_security.rb:209:in `sanitize_for_mass_assignment'' /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activerecord-3.1.1/ lib/active_record/base.rb:1744:in `assign_attributes'' /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activerecord-3.1.1/ lib/active_record/base.rb:1567:in `initialize'' /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activerecord-3.1.1/ lib/active_record/reflection.rb:190:in `new'' Everything was working on Friday last with Rails-3.0.9 and no changes to the code or the features have been made. I am therefore somewhat curious as to what might be causing this. I previously had mass assignment turned off in an initializer: $ cat config/initializers/attr_accessible_nil.rb #ActiveRecord::Base.send(:attr_accessible, nil) So, I am wondering if this might be the cause of the problem. Note that I have no intention of moving to Rails-3.1.1 at the moment. I am just curious as to what would be causing this error. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I found my problem is a library I wrote to turn off mass assignment . In it I am calling this: # override AR method def mass_assignment_authorizer if accessible == :all self.class.protected_attributes else super + ( accessible || [] ) end end Mass_assignment_authorizer has a different signature in Rails 3.1 thus the problem. By my way of thinking the signature change means that we should be talking of Rails-4.0.1 instead of Rails-3.1.1. But, then again, given what has happened to Firefox perhaps not. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Nov-10 15:08 UTC
Re: Problem with Rails3.1.1 in mass_assignment_authorizer
On Nov 7, 9:27 pm, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote:> I found my problem is a library I wrote to turn off mass assignment . > In it I am calling this: > > # override AR method > def mass_assignment_authorizer > if accessible == :all > self.class.protected_attributes > else > super + ( accessible || [] ) > end > end > > Mass_assignment_authorizer has a different signature in Rails 3.1 thus > the problem. By my way of thinking the signature change means that we > should be talking of Rails-4.0.1 instead of Rails-3.1.1. But, then > again, given what has happened to Firefox perhaps not.You can''t expect every single internal rails method not to change between rails versions (although public methods should certainly not change signature like that). One of the things 3.0 was supposed to bring was greater clarity about what bits of the internals could be depended upon in this manner and which couldn''t. Part of that involved breaking up action controller into more reusable components, but I''m not sure where things got to with active record. Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. 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
- Noob Rails patcher - problems running the sqlite3 tests...
- ruby-1.8.7 + mysql-5.1.58 = Mysql::Error: #08S01Bad handshake
- rake aborted with ruby on rails
- undefined method `to_sym' for nil:NilClass