Permalink
Browse files

Allow declarative_authorization to be used without ActiveRecord

  • Loading branch information...
bterkuile committed May 23, 2012
1 parent 4819d0c commit a1db63a41f654bb8a45d7aa48363de48be28b78e
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/declarative_authorization.rb
@@ -1,8 +1,10 @@
require File.join(%w{declarative_authorization rails_legacy})
require File.join(%w{declarative_authorization helper})
require File.join(%w{declarative_authorization in_controller})
-require File.join(%w{declarative_authorization in_model})
-require File.join(%w{declarative_authorization obligation_scope})
+if defined?(ActiveRecord)
+ require File.join(%w{declarative_authorization in_model})
+ require File.join(%w{declarative_authorization obligation_scope})
+end
min_rails_version = "2.1.0"
if Rails::VERSION::STRING < min_rails_version
@@ -14,4 +16,4 @@
ActionController::Base.send :include, Authorization::AuthorizationInController
ActionController::Base.helper Authorization::AuthorizationHelper
-ActiveRecord::Base.send :include, Authorization::AuthorizationInModel
+ActiveRecord::Base.send :include, Authorization::AuthorizationInModel if defined?(ActiveRecord)

0 comments on commit a1db63a

Please sign in to comment.