Skip to content

Commit

Permalink
Add CanCan support
Browse files Browse the repository at this point in the history
  • Loading branch information
jarijokinen committed Jan 15, 2013
1 parent d3daac2 commit 7ad45a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/controllers/simple_resource/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
module SimpleResource
class BaseController < ::ApplicationController
if defined?(CanCan)
load_and_authorize_resource

rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, alert: exception.message
end
end

inherit_resources
defaults route_prefix: ""

Expand Down

0 comments on commit 7ad45a6

Please sign in to comment.