Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

turning into a funtioning Rails plugin

  • Loading branch information...
commit aaed265c910d2a27d147cd613b1cfbcfb6694aa9 1 parent 1034c81
@ryanb authored
Showing with 11 additions and 9 deletions.
  1. +1 −0  init.rb
  2. +5 −6 lib/cancan.rb
  3. +5 −3 lib/cancan/controller_additions.rb
View
1  init.rb
@@ -0,0 +1 @@
+require 'cancan'
View
11 lib/cancan.rb
@@ -1,8 +1,7 @@
-$:.unshift(File.dirname(__FILE__))
-require 'cancan/instance_exec'
-require 'cancan/ability'
-require 'cancan/controller_additions'
-
module CanCan
class AccessDenied < StandardError; end
-end
+end
+
+require File.dirname(__FILE__) + '/cancan/instance_exec'
+require File.dirname(__FILE__) + '/cancan/ability'
+require File.dirname(__FILE__) + '/cancan/controller_additions'
View
8 lib/cancan/controller_additions.rb
@@ -35,6 +35,8 @@ def load_and_authorize_resource
end
end
-class ActionController::Base
- include CanCan::ControllerAdditions
-end
+if defined? ActionController
+ ActionController::Base.class_eval do
+ include CanCan::ControllerAdditions
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.