ruby on rails - Rolify abilities returning false -


i'm experiencing strange issue using rolify (click tutorial i'm following) rails: can method not seem work, therefore rendering user privileges unuseable. below ability.rb file , console output problem demonstrated.

class ability   include cancan::ability    def initialize(user)      user ||= user.new # guest user (not logged in)      if user.has_role? :admin       can :manage, :all     else       can :read, :all     end    end end 

console tests ($ rails console)

user = user.find(2) user.add_role "admin" user.has_role? :admin => **true**  ability = ability.new(user) ability.can? :manage, :all => **false** ability.can? :read, :all => **false** 

i checked in database , relationships set correctly. i'm running rails 3.2.13.

the problem gem conflict either canard or declarative_authorization. disabling both , restarting rails server solved issue. perhaps others have gone down same path in trying these different gems.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -