lib/simple_captcha/engine.rb in glebtv-simple_captcha-0.2.1 vs lib/simple_captcha/engine.rb in glebtv-simple_captcha-0.3.1
- old
+ new
@@ -1,25 +1,22 @@
# encoding: utf-8
+
require 'rails'
require 'simple_captcha'
module SimpleCaptcha
class Engine < ::Rails::Engine
- config.before_initialize do
- unless defined?(Mongoid)
+ unless Object.const_defined?("Mongoid")
+ config.before_initialize do
ActiveSupport.on_load :active_record do
ActiveRecord::Base.send(:include, SimpleCaptcha::ModelHelpers)
end
end
end
config.after_initialize do
ActionView::Base.send(:include, SimpleCaptcha::ViewHelper)
ActionView::Helpers::FormBuilder.send(:include, SimpleCaptcha::FormBuilder)
-
- if Object.const_defined?("Formtastic") && Formtastic.const_defined?("Inputs")
- require "simple_captcha/formtastic"
- end
end
config.app_middleware.use SimpleCaptcha::Middleware
end
end