class Ability

Public Class Methods

new(user) click to toggle source

The current user model is passed into the initialize method, so the permissions can be modified based on any user attributes.

# File app/models/ability.rb, line 4
def initialize(user)
        user ||= User.new

        can [:read,:create], User

        can :dashboard, User do
                user.persisted? && user.is_common_user?
        end

        can [:availability, :activate], User do
                user.persisted?
        end
end