Sha256: b1fa269b1f17861d01ec54bc0d26e76a4ca68252d8b93e756ec11a6dc0a85511

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

# Load Dragonfly for Rails if it isn't loaded already.
require "dragonfly/rails/images"

# Use a separate Dragonfly "app" for CKEditor.
app = Dragonfly[:ckeditor]
app.configure_with(:rails)
app.configure_with(:imagemagick)

# Define the ckeditor_file_accessor macro.
app.define_macro(ActiveRecord::Base, :ckeditor_file_accessor) if defined?(ActiveRecord::Base)
app.define_macro_on_include(Mongoid::Document, :ckeditor_file_accessor) if defined?(Mongoid::Document)

app.configure do |c|
  # Store files in public/system/ckeditor_assets. This is not
  # mandatory and the files don't even have to be stored under
  # public. If not storing under public then set server_root to nil.
  c.datastore.root_path = Rails.root.join("public", "system", "ckeditor_assets", Rails.env).to_s
  c.datastore.server_root = Rails.root.join("public").to_s

  # Accept asset requests on /ckeditor_assets. Again, this is not
  # mandatory. Just be sure to include :job somewhere.
  c.url_format = "/ckeditor_assets/:job/:basename.:format"
end

# Insert our Dragonfly "app" into the stack.
Rails.application.middleware.insert_after Rack::Cache, Dragonfly::Middleware, :ckeditor

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
glebtv-ckeditor-4.0.2.7 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2.6 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2.5 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2.4 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2.2 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.2 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.0.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
ckeditor-3.7.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
ckeditor-3.7.0 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb