ejholmes / active_admin_editor

Rich text editor for Active Admin using wysihtml5.
MIT License
184 stars 134 forks source link

Problem with cache_classes = true #53

Open badosu opened 10 years ago

badosu commented 10 years ago

Deploying to heroku I've seen some problems when this is set to true.

For some reason, formtastic does not reload some classes when it's needed. So I see things like:

NoMethodError: undefined method `editor' for #<ActiveAdmin::Application:0x007f08134ae5f8>
ActionView::Template::Error (Unable to find input class HtmlEditorInput)
/app/config/initializers/active_admin_editor.rb:1:in `<top (required)>': uninitialized constant ActiveAdmin::Editor (NameError)

See: https://github.com/rails/spring/issues/95 for references.

I was able to make a workaround for this error, prepending this to the initializer:

require 'active_admin_editor'
require "#{Gem::Specification.find_by_name("active_admin_editor").gem_dir}/app/inputs/html_editor_input"

This is problem an error more related to Formtastic than to this gem, but this should be useful for someone who has the same problem.