Sha256: b5e17c2e29e83ef419e5bcf87440736c4e9a5ddbaad70c8924921191463ece36

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

require 'dragonfly'
require 'rack/cache'

### The dragonfly app ###

app = Dragonfly::App[:images]
app.configure_with(Dragonfly::RMagickConfiguration)
app.configure do |c|
  c.log = Rails.logger
  c.datastore.configure do |d|
    d.root_path = "#{Rails.root}/public/system/dragonfly/#{Rails.env}"
  end
  c.url_handler.configure do |u|
    u.protect_from_dos_attacks = false
    u.path_prefix = '/media'
  end
end

### Extend active record ###
ActiveRecord::Base.extend Dragonfly::ActiveRecordExtensions
ActiveRecord::Base.register_dragonfly_app(:image, app)

### Insert the middleware ###
# Where the middleware is depends on the version of Rails
middleware = Rails.respond_to?(:application) ? Rails.application.middleware : ActionController::Dispatcher.middleware
middleware.insert_after Rack::Lock, Dragonfly::Middleware, :images
middleware.insert_before Dragonfly::Middleware, Rack::Cache, {
  :verbose     => true,
  :metastore   => "file:#{Rails.root}/tmp/dragonfly/cache/meta",
  :entitystore => "file:#{Rails.root}/tmp/dragonfly/cache/body"
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dragonfly-0.5.7 lib/dragonfly/rails/images.rb
dragonfly-0.5.6 lib/dragonfly/rails/images.rb
dragonfly-0.5.5 lib/dragonfly/rails/images.rb
dragonfly-0.5.4 lib/dragonfly/rails/images.rb
dragonfly-0.5.3 lib/dragonfly/rails/images.rb
dragonfly-0.5.2 lib/dragonfly/rails/images.rb
dragonfly-0.5.1 lib/dragonfly/rails/images.rb
dragonfly-0.5.0 lib/dragonfly/rails/images.rb