Sha256: 29d66676a7c303c7771651d13a31ce2d5777205fac257d31583406ccf41a4f09

Contents?: true

Size: 855 Bytes

Versions: 8

Compression:

Stored size: 855 Bytes

Contents

require 'dragonfly'
require 'rack/cache'
require 'uri'

### The dragonfly app ###
app = Dragonfly[:images]
app.configure_with(:rails)
app.configure_with(:imagemagick)

### Extend active record ###
app.define_macro(ActiveRecord::Base, :image_accessor)

### 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, app.url_path_prefix
middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
  :verbose     => true,
  :metastore   => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded because Windows
  :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")  # has problems with spaces
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
dragonfly-0.8.6 lib/dragonfly/rails/images.rb
dragonfly-0.8.5 lib/dragonfly/rails/images.rb
dragonfly-0.8.4 lib/dragonfly/rails/images.rb
fog-dragonfly-0.8.2 lib/dragonfly/rails/images.rb
dragonfly-0.8.2 lib/dragonfly/rails/images.rb
fog-dragonfly-0.8.1 lib/dragonfly/rails/images.rb
dragonfly-0.8.1 lib/dragonfly/rails/images.rb
dragonfly-0.8.0 lib/dragonfly/rails/images.rb