Permalink
Browse files

Merge pull request #146 from bterkuile/master

Allow declarative_authorization to be used without ActiveRecord
  • Loading branch information...
2 parents 4819d0c + a1db63a commit 86b521f24a60bd4c4b136c7b84150fb0b3487b88 @stffn committed Jun 12, 2012
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 86b521f

Please sign in to comment.