lib/ckeditor/engine.rb in ckeditor-3.5.4 vs lib/ckeditor/engine.rb in ckeditor-3.6.0.pre
- old
+ new
@@ -1,22 +1,23 @@
require 'rails'
-require 'ckeditor'
module Ckeditor
class Engine < ::Rails::Engine
- initializer "ckeditor_engine.add_middleware" do |app|
- app.middleware.insert_before(
- ActionDispatch::Cookies,
- "Ckeditor::Middleware",
- app.config.send(:session_options)[:key])
+ config.action_view.javascript_expansions[:ckeditor] = "ckeditor/ckeditor"
+
+ initializer "ckeditor.helpers" do
+ ActiveSupport.on_load(:action_controller) do
+ ActionController::Base.send :include, Ckeditor::Helpers::Controllers
+ end
+
+ ActiveSupport.on_load :action_view do
+ ActionView::Base.send :include, Ckeditor::Helpers::ViewHelper
+ ActionView::Base.send :include, Ckeditor::Helpers::FormHelper
+ ActionView::Helpers::FormBuilder.send :include, Ckeditor::Helpers::FormBuilder
+ end
end
-
- config.after_initialize do
- ActionView::Base.send :include, Ckeditor::ViewHelper
- ActionView::Helpers::FormBuilder.send :include, Ckeditor::FormBuilder
-
- ActionView::Helpers::AssetTagHelper.register_javascript_expansion :ckeditor => ["ckeditor/ckeditor"]
-
+
+ initializer "ckeditor.hooks" do
if Object.const_defined?("Formtastic")
::Formtastic::SemanticFormBuilder.send :include, Ckeditor::Hooks::FormtasticBuilder
end
if Object.const_defined?("SimpleForm")