Sha256: e732b3104c3294d3c7064ceea870872b8e430bb847a9571f0453160fbdd94acf

Contents?: true

Size: 1009 Bytes

Versions: 13

Compression:

Stored size: 1009 Bytes

Contents

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.is?(: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/ryanb/cancan/wiki/Defining-Abilities
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
mix-rails-0.12.1 mix-rails-auth/app/models/ability.rb
mix-rails-auth-0.12.1 app/models/ability.rb
mix-rails-auth-0.11.0 app/models/ability.rb
mix-rails-0.10.4 mix-rails-auth/app/models/ability.rb
mix-rails-auth-0.10.4 app/models/ability.rb
mix-rails-0.10.3 mix-rails-auth/app/models/ability.rb
mix-rails-auth-0.10.3 app/models/ability.rb
mix-rails-auth-0.10.2 app/models/ability.rb
mix-rails-auth-0.10.1 app/models/ability.rb
mix-rails-0.7.0 auth/app/models/ability.rb
mix-rails-0.6.0 auth/app/models/ability.rb
mix-rails-0.5.0 auth/app/models/ability.rb
mix-auth-0.4.0 app/models/ability.rb