README.md in abilities-0.0.4 vs README.md in abilities-0.1.0

- old
+ new

@@ -16,11 +16,11 @@ $ bundle ``` ## Configuration -Generate the abilities initializer: +Generate the abilities configuration file: ``` bundle exec rails g abilities:install ``` Ensure there is a current_user helper available in your controllers and views: @@ -31,22 +31,27 @@ @current_user ||= User.find_by(id: session[:user_id]) end end ``` -NOTE: The gem will look for a User model and include Abilities::Concern into it. +Add the abilities concern to the model: +```ruby +class User < ActiveRecord::Base + include Abilities::Concern +end +``` ## Usage ### Defining -All the abilities are defined in config/initializers/abilities.rb by can and cannot methods: +All the abilities are defined in config/abilities.rb by can and cannot methods: ```ruby Abilities.define do can :create, Post cannot :destroy, User unless admin? - can :edit, Post do |post| - post.user == self + can :edit, Post do |subject| + subject.user == self end can :manage, User can :touch, :all end ```