Sha256: 7907439a40ad78a5417fd85aa9ec58d12bab4ff0d68305c98e434a40a2436763

Contents?: true

Size: 851 Bytes

Versions: 5

Compression:

Stored size: 851 Bytes

Contents

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

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

### 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

5 entries across 5 versions & 1 rubygems

Version Path
dragonfly-0.7.7 lib/dragonfly/rails/images.rb
dragonfly-0.7.6 lib/dragonfly/rails/images.rb
dragonfly-0.7.5 lib/dragonfly/rails/images.rb
dragonfly-0.7.4 lib/dragonfly/rails/images.rb
dragonfly-0.7.3 lib/dragonfly/rails/images.rb