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