Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (19 sloc) 608 Bytes
puts "Installing CanCan for authorization"
gem "cancan" # authorization
create_file "app/models/ability.rb",
%q(class Ability
include CanCan::Ability
def initialize(user)
user ||= # in case of guest
# can :manage, Something, :user_id =>
can :read, :all
inject_into_class "app/controllers/application_controller.rb" %q(
# Use this method in your controllers to load and authorize resources with CanCan
# load_and_authorize_resource
# rescue_from CanCan::AccessDenied do |ex|
# flash[:alert] = ex.message
# redirect_to user_path(@user)
# end
Jump to Line
Something went wrong with that request. Please try again.