lib/protector.rb in protector-0.3.0 vs lib/protector.rb in protector-0.3.1
- old
+ new
@@ -7,6 +7,17 @@
require "protector/adapters/sequel"
I18n.load_path += Dir[File.expand_path File.join('..', 'locales', '*.yml'), File.dirname(__FILE__)]
Protector::Adapters::ActiveRecord.activate! if defined?(ActiveRecord)
-Protector::Adapters::Sequel.activate! if defined?(Sequel)
+Protector::Adapters::Sequel.activate! if defined?(Sequel)
+
+module Protector
+
+ # Allows executing any code having Protector globally disabled
+ def self.insecurely(&block)
+ Thread.current[:protector_disabled] = true
+ yield
+ ensure
+ Thread.current[:protector_disabled] = false
+ end
+end
\ No newline at end of file