2018-02-07 18:43:36 +00:00
|
|
|
require "rails/engine"
|
|
|
|
|
|
|
|
module ActiveText
|
|
|
|
class Engine < Rails::Engine
|
2018-02-08 17:01:46 +00:00
|
|
|
isolate_namespace ActiveText
|
2018-02-07 18:43:36 +00:00
|
|
|
config.eager_load_namespaces << ActiveText
|
2018-02-08 20:48:45 +00:00
|
|
|
|
|
|
|
initializer "active_text.attribute" do
|
|
|
|
ActiveSupport.on_load(:active_record) do
|
|
|
|
include ActiveText::Attribute
|
|
|
|
end
|
|
|
|
end
|
2018-02-12 15:16:49 +00:00
|
|
|
|
2018-02-12 23:21:49 +00:00
|
|
|
initializer "active_text.active_storage_extension" do
|
|
|
|
require "active_storage/blob"
|
|
|
|
|
|
|
|
class ActiveStorage::Blob
|
|
|
|
include ActiveText::Attachable
|
|
|
|
|
|
|
|
def previewable_attachable?
|
|
|
|
representable?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-12 15:16:49 +00:00
|
|
|
# FIXME: Aren't helpers supposed to load automatically?
|
|
|
|
# https://github.com/rails/rails/issues/26627 ?
|
|
|
|
initializer "active_text.helper" do
|
|
|
|
ActiveSupport.on_load(:action_controller_base) do
|
|
|
|
helper ActiveText::TagHelper
|
|
|
|
end
|
|
|
|
end
|
2018-02-07 18:43:36 +00:00
|
|
|
end
|
|
|
|
end
|