Permalink
Browse files

Added force_reload and force_reload? to allow reload of DSL files whe…

…n needed
  • Loading branch information...
tamerdark
tamerdark committed Aug 25, 2012
1 parent 0d0015b commit b508c3c008ed4b72e9fe2ec7802bfafbc6c4590b
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/declarative_authorization/authorization.rb
@@ -277,6 +277,18 @@ def roles_for (user)
def roles_with_hierarchy_for(user)
flatten_roles(roles_for(user))
end
+
+ def self.force_reload
+ @@force_reload = true
+ end
+
+ def self.force_reload?
+ if defined? @@force_reload
+ temp = @@force_reload
+ @@force_reload = false
+ end
+ temp
+ end
def self.development_reload?
if Rails.env.development?
@@ -293,7 +305,7 @@ def self.development_reload?
# 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 or development_reload?
+ if dsl_file or development_reload? or force_reload?
@@instance = new(dsl_file)
else
@@instance ||= new

0 comments on commit b508c3c

Please sign in to comment.