# -*- encoding : utf-8 -*- require 'rails' require 'tiny_captcha' module TinyCaptcha class Engine < ::Rails::Engine config.before_initialize do ActiveSupport.on_load :active_record do ActiveRecord::Base.send(:include, TinyCaptcha::ModelHelpers) end end config.after_initialize do ActionView::Base.send(:include, TinyCaptcha::ViewHelper) ActionView::Helpers::FormBuilder.send(:include, TinyCaptcha::FormBuilder) ActionController::Base.send :include, ::TinyCaptcha::ControllerHelpers if Object.const_defined?("Formtastic") if Formtastic.const_defined?("Helpers") Formtastic::Helpers::FormHelper.builder = TinyCaptcha::CustomFormBuilder else Formtastic::SemanticFormHelper.builder = TinyCaptcha::CustomFormBuilder end end end config.app_middleware.use TinyCaptcha::Middleware end end