Skip to content

Commit

Permalink
Dependancies from ActiveRecord removed. It must work with ActiveModel…
Browse files Browse the repository at this point in the history
… now.
  • Loading branch information
opusmagnum committed Jun 25, 2010
1 parent 0c7d8f7 commit 79ccff3
Show file tree
Hide file tree
Showing 2 changed files with 1,701 additions and 1,701 deletions.
8 changes: 4 additions & 4 deletions lib/declarative_authorization.rb
@@ -1,17 +1,17 @@
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})
#require File.join(%w{declarative_authorization in_model})
#require File.join(%w{declarative_authorization obligation_scope})

min_rails_version = "2.1.0"
if Rails::VERSION::STRING < min_rails_version
raise "declarative_authorization requires Rails #{min_rails_version}. You are using #{Rails::VERSION::STRING}."
end

require File.join(%w{declarative_authorization railsengine}) if defined?(::Rails::Engine)
#require File.join(%w{declarative_authorization railsengine}) if defined?(::Rails::Engine)

ActionController::Base.send :include, Authorization::AuthorizationInController
ActionController::Base.helper Authorization::AuthorizationHelper

ActiveRecord::Base.send :include, Authorization::AuthorizationInModel
#ActiveRecord::Base.send :include, Authorization::AuthorizationInModel

2 comments on commit 79ccff3

@stffn
Copy link

@stffn stffn commented on 79ccff3 Jul 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great to have ActiveRecord support on by default and a switch to disable the dependency. Alternatively, we could just deactivate the dependency if AR is not available. Then, AR-related tests could be disabled with an environment variable.

@opusmagnum
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I am not so experienced in framework design and meta programming (for example to check the availability of AR). My intension was to "quick&dirty" proof if declarative_authorization will work with Active Model (Couch DB based). It does work!
Please let me know if I could support what you are talking about. To test it with my code or so.
Thanks for the good framework!

Please sign in to comment.