Sha256: 5990e2ebaf7581937df0ab8b5c993e1c32ea6f07419be10f1131914b2e9a7d01

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

module ExpenseGun
  class Ability
    include CanCan::Ability

    def initialize(user)
      can :list,   Expense
      can :create, Expense
      can :show,   Expense
      
      can :edit, Expense do |expense|
        expense.may_edit?
      end
      can :submit, Expense do |expense|
        expense.may_submit?
      end
      
      can :accept, Expense do |expense|
        expense.may_accept?
      end
      
      can :refuse, Expense do |expense|
        expense.may_refuse?
      end
      
      can :cancel, Expense do |expense|
        expense.may_cancel?
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
expense_gun-1.0.3 app/models/expense_gun/ability.rb
expense_gun-1.0.2 app/models/expense_gun/ability.rb
expense_gun-1.0.1 app/models/expense_gun/ability.rb
expense_gun-1.0.0 app/models/expense_gun/ability.rb