accessible_attributes wrong number of arguments (1 for 0) with rails 3.2.5 #419

Closed
darragh opened this Issue Jun 1, 2012 · 5 comments

Projects

None yet

2 participants

@darragh
Contributor
darragh commented Jun 1, 2012

I've narrowed it down to what goes on in accessible.rb (I guess :accessible_attributes can no longer be a simple class_attribute)

This prevents us upgrading an application using mongo_mapper to rails 3.2.5

.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/core_ext/class/attribute.rb:75:in `accessible_attributes': wrong number of arguments (1 for 0) (ArgumentError)
    from /Users/darragh/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.2.5/lib/action_controller/metal/params_wrapper.rb:175:in `_set_wrapper_defaults'
    from /Users/darragh/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.2.5/lib/action_controller/metal/params_wrapper.rb:133:in `inherited'
    from /Users/darragh/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.2.5/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with'
    from /Users/darragh/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.2.5/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with'

I don't have a patch right now.

@darragh
Contributor
darragh commented Jun 1, 2012

That stack tace doesn't make things clear, but debugging through it, it happens when the first class including MongoMapper::Document is loaded by our app.

I believe a simple way to reproduce would be to create a new rails 3.2.5 app with mongo_mapper and a single model and try to boot it.

@michaelrigart

hi darragh,

I can confirm this bug. The error is caused due to this commit:
rails/rails@bfb25f9

Looks like it's due to the new role parameter that has been added.

@michaelrigart

could this be a naming conflict between the Accessible plugins class_attribute :accessible_attributes and the ActiveModel::MassAssignmentSecurity "accessible_attributes" class method?

@darragh
Contributor
darragh commented Jun 6, 2012

4d35c67 seems to resolve this

@darragh
Contributor
darragh commented Jun 6, 2012

Closing, since master now has a fix for this

@darragh darragh closed this Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment