Sha256: 292f2f10a405dfd2ff1772f343f9b1c8bce21cbf1b60b5fd6f7024625cf4e06c

Contents?: true

Size: 362 Bytes

Versions: 3

Compression:

Stored size: 362 Bytes

Contents

module Hitchens
  class Ability
    include CanCan::Ability

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hitchens-0.0.3 app/models/hitchens/ability.rb
hitchens-0.0.2 app/models/hitchens/ability.rb
hitchens-0.0.1 app/models/hitchens/ability.rb