Sha256: 9dffd454d651dbaa37cc866382a0903569b6342e7601683fa2798239333b513a

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

class Ability
  include CanCan::Ability

  def initialize(user)
    if !user.nil?
      if user.id == 1
        can :manage, :all
      end
    end
    # Define abilities for the passed in user here. For example:
    #
    #   user ||= User.new # guest user (not logged in)
    #   if user.admin?
    #     can :manage, :all
    #   else
    #     can :read, :all
    #   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.
    # If you pass :all it will apply to every resource. Otherwise pass a Ruby
    # class of the resource.
    #
    # The third argument is an optional hash of conditions to further filter the
    # objects.
    # For example, here the user can only update published articles.
    #
    #   can :update, Article, :published => true
    #
    # See the wiki for details:
    # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beautiful_scaffold-2.0.3 lib/generators/templates/app/models/ability.rb
beautiful_scaffold-2.0.2 lib/generators/templates/app/models/ability.rb
beautiful_scaffold-2.0.1 lib/generators/templates/app/models/ability.rb