class Ability
Public Class Methods
new(user)
click to toggle source
# File lib/generators/corral/ability/templates/ability.rb, line 4 def initialize(user) # Define abilities for the passed in user here. For example: # # user ||= User.new # guest user (not logged in) # if user.admin? # allow_anything! # else # can :read, Post # end # # The first argument to `can` is the action you are giving the user # permission to do. # If you pass :manage it will apply to every action. Other common actions # here are :read, :create, :update and :destroy. # # The second argument is the resource the user can perform the action on. # Pass a Ruby class of the resource. # # can :update, Article # end