Skip to content

Commit

Permalink
installed cancancan
Browse files Browse the repository at this point in the history
  • Loading branch information
Dujota committed Jun 8, 2021
1 parent c343667 commit 799b6c3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ gem "rufo", "~> 0.13.0", :groups => [:development, :test]
gem "pry", "~> 0.14.1", :groups => [:development, :test]

gem "devise", "~> 4.8"

gem "cancancan", "~> 3.2"
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ GEM
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
cancancan (3.2.2)
coderay (1.1.3)
concurrent-ruby (1.1.9)
crass (1.0.6)
Expand Down Expand Up @@ -255,6 +256,7 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
cancancan (~> 3.2)
devise (~> 4.8)
factory_bot_rails (~> 6.2)
jbuilder (~> 2.7)
Expand Down
34 changes: 34 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

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
# 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

0 comments on commit 799b6c3

Please sign in to comment.