Sha256: a2ccc4f5944586446864bc3ac4c8c261ffeb86f41e40cfef4011e33e9d68cc48

Contents?: true

Size: 1.12 KB

Versions: 50

Compression:

Stored size: 1.12 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/uploads/ckeditor. 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", "uploads", "ckeditor", 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 = "/uploads/ckeditor/:job/:basename.:format"
end

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

Version data entries

50 entries across 50 versions & 4 rubygems

Version Path
glebtv-ckeditor-4.4.7.4 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.7.3 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.7.2 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.7.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.7 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.6 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
ckeditor-4.1.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.3.4 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.3.3 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.3.2 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.3.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.4.3.0 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.6 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
ckeditor-4.1.0 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.5 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
ckeditor-4.0.11 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.4 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.3 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.2 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb
glebtv-ckeditor-4.3.2.1 lib/generators/ckeditor/templates/base/dragonfly/initializer.rb