Class: Hitchens::Ability
- Inherits:
-
Object
- Object
- Hitchens::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/hitchens/ability.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(user) ⇒ Ability
Returns a new instance of Ability.
5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/hitchens/ability.rb', line 5 def initialize(user) user ||= Hitchens.user_class.new # guest user (not logged in) if user.__send__ Hitchens.blog_admin_user_method can :manage, :all else can :read, Post, Post.published do |post| post.published end end end |