Skip to content

Commit

Permalink
optimization for production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stffn committed Aug 22, 2008
1 parent 58bbc31 commit 292e73f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/authorization.rb
Expand Up @@ -34,7 +34,7 @@ def self.current_user=(user)
# For use in test cases only
def self.ignore_access_control (state = nil) # :nodoc:
@@ignore_access_control = state unless state.nil?
@@ignore_access_control
ENV['RAILS_ENV'] == 'test' and @@ignore_access_control
end

# Authorization::Engine implements the reference monitor. It may be used
Expand Down Expand Up @@ -176,7 +176,7 @@ def obligations (privilege, options = {})
# yet. If +dsl_file+ is given, it is passed on to Engine.new and
# a new instance is always created.
def self.instance (dsl_file = nil)
if dsl_file
if dsl_file or ENV['RAILS_ENV'] == 'development'
@@instance = new(dsl_file)
else
@@instance ||= new
Expand Down
2 changes: 1 addition & 1 deletion lib/in_controller.rb
Expand Up @@ -10,7 +10,7 @@ def self.included(base) # :nodoc:

# Returns the Authorization::Engine for the current controller.
def authorization_engine
@authorization_engine ||= Authorization::Engine.new
@authorization_engine ||= Authorization::Engine.instance
end

# If the current user meets the given privilege, permitted_to? returns true
Expand Down

0 comments on commit 292e73f

Please sign in to comment.