Closed mina-samy closed 10 years ago
Do it work without acts_at :user
?
how whould it work without acts_as :user ? this way I wont specify the children classes !
For a test, remove acts_as :user
form Admin
model and then in console try something like Admin.new
I'm having also the same error after updating to rails 3.2.14, but I don't know if it has something to do with it... here's some lines of the stacktrace:
ArgumentError - wrong number of arguments (3 for 2):
acts_as_relation (1.0.0) lib/active_record/acts_as_relation.rb:65:in `block (2 levels) in acts_as'
acts_as_relation (1.0.0) lib/active_record/acts_as_relation.rb:112:in `block in acts_as'
acts_as_relation (1.0.0) lib/active_record/acts_as_relation.rb:111:in `acts_as'
app/models/provider.rb:12:in `<class:Provider>'
app/models/provider.rb:11:in `<top (required)>'
activesupport (3.2.14) lib/active_support/dependencies.rb:469:in `block in load_file'
activesupport (3.2.14) lib/active_support/dependencies.rb:639:in `new_constants_in'
activesupport (3.2.14) lib/active_support/dependencies.rb:468:in `load_file'
activesupport (3.2.14) lib/active_support/dependencies.rb:353:in `require_or_load'
activesupport (3.2.14) lib/active_support/dependencies.rb:502:in `load_missing_constant'
activesupport (3.2.14) lib/active_support/dependencies.rb:192:in `block in const_missing'
activesupport (3.2.14) lib/active_support/dependencies.rb:190:in `const_missing'
activesupport (3.2.14) lib/active_support/dependencies.rb:514:in `load_missing_constant'
activesupport (3.2.14) lib/active_support/dependencies.rb:192:in `block in const_missing'
activesupport (3.2.14) lib/active_support/dependencies.rb:190:in `const_missing'
app/models/ability.rb:10:in `initialize'
cancan (1.6.10) lib/cancan/controller_additions.rb:357:in `current_ability'
app/controllers/dashboard_controller.rb:9:in `index'
1.0
is for rails >= 4.0
for rails ~> 3
use this in your Gemfile
gem 'acts_as_relation', '~> 0.1'
I added the acts_as_relation gem to the gem file, and I have a User class where I included the "acts_as_superclass" statement,
the children of the User class are Admin Swimmer Coach
where I added the "acts_as :user" statement and I added ":as_relation_superclass => true" to my User table DB migration
but this Error appears whenever I try to view the Admin class by writing Admin in the rails console
what am I doing wrong ? sorry for the stupid question but I am a beginner