Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 715 Bytes

installation.md

File metadata and controls

35 lines (23 loc) · 715 Bytes

Installation

Add this to your Gemfile:

gem 'cancancan'

and run the bundle install command.

Use the provided command to generate a template for your abilities file:

rails generate cancan:ability

This will generate the following file:

# /app/models/ability.rb

class Ability
  include CanCan::Ability

  def initialize(user)
  end
end

This is everything you need to start. 💥

All the permissions will be defined in this file. You can of course split it into multiple files if your application grows, but we'll cover that in a later chapter.

Let's now start with the basic concepts: define and check abilities.