EppO/rolify — Issue #28: undefined method `is_admin?' for #<User:0x00000102de3cc8>
Author: polysaturate
Created: 2012-01-11 07:56:59+00:00
State: open

Tried everything I can see in this tutorial, readme, etc

`ruby-1.9.2-p180 :010 > User.first.roles
User Load (0.1ms) SELECT "users".* FROM "users" LIMIT 1
Role Load (0.1ms) SELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = 1
=> [#] `

I only have one user, which works out well for my purpose of this bug....

`ruby-1.9.2-p180 :009 > User.first.has_role? "admin"
User Load (0.1ms) SELECT "users".* FROM "users" LIMIT 1
(0.1ms) SELECT COUNT(*) FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = 1 AND (((name = 'admin') AND (resource_typ
e IS NULL) AND (resource_id IS NULL)))
=> true `

So...has_role? works...

` User Load (0.1ms) SELECT "users".* FROM "users" LIMIT 1
NoMethodError: undefined method 'is_admin?' for #
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.1.2/lib/active_model/attribute_methods.rb:385:in 'method_missing'
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.2/lib/active_record/attribute_methods.rb:60:in 'method_missing'
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/rolify-2.1.0/lib/rolify/role.rb:83:in 'method_missing'
from (irb):11
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.2/lib/rails/commands/console.rb:45:in 'start'
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.2/lib/rails/commands/console.rb:8:in 'start'
from /Users/polysaturate04/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.2/lib/rails/commands.rb:40:in ''
from script/rails:6:in 'require'
from script/rails:6:in '

'`

and there we go, is_admin(re: dynamic shortcuts) fails to work. To me, it seems to be tripping up on something specific to the role's method missing.

To add, there are no gems outside of rolify and cancan. I am rolling my own, very simple authentication at this time, using the User class/model/table.