hugodias/san-pedro-valley-jobs

View on GitHub
app/models/ability.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Ability
  include CanCan::Ability

  def initialize(user)
    # Define abilities for the passed in user here. For example:
    #
    user ||= User.new # guest user (not logged in)
    if user.admin?
      can :manage, :all
      can :manage, :dashboard
    else
      can :read, Company
      can :read, JobType
      can :read, Category
      can :read, Job, &:published?
      can :create, Job
    end
  end
end