Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ability
- include CanCan::Ability
- def initialize(dashboard_user)
- if dashboard_user.role_id == 1 then
- can :manage, :all
- else
- can :read, :summary
- can :read, :home
- end
- end
- end
- def current_user
- current_dashboard_user
- end
- #For authorization using cancancan
- protected
- rescue_from CanCan::AccessDenied do |exception|
- redirect_to main_app.root_url, :alert => exception.message
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement