Sha256: 8dc3878bfad6da22fd336d8aa0199801f4ed59d1d705b30d2ce13532cbce84c9

Contents?: true

Size: 1.54 KB

Versions: 57

Compression:

Stored size: 1.54 KB

Contents

Using With Rails 2.3
====================

**NOTE: RAILS 2.3 IS NOT SUPPORTED IN NEW VERSIONS OF DRAGONFLY SO PLEASE USE VERSION 0.8.5**

Setting up the quick way
------------------------
config/initializers/dragonfly.rb:

    require 'dragonfly/rails/images'

Setting up the more explicit way
--------------------------------
You can do the above explicitly.

config/initializers/dragonfly.rb:

    require 'dragonfly'

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

    app.define_macro(ActiveRecord::Base, :image_accessor)

environment.rb:

    config.middleware.insert 0, 'Dragonfly::Middleware', :images, '/media'
    config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
      :verbose     => true,
      :metastore   => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"),
      :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
    }

Gems
----
environment.rb

    config.gem 'dragonfly', '0.8.5'
    config.gem 'rack-cache', :lib => 'rack/cache'

Capistrano
----------
If using Capistrano with the above, you probably will want to keep the cache between deploys, so in deploy.rb:

    namespace :dragonfly do
      desc "Symlink the Rack::Cache files"
      task :symlink, :roles => [:app] do
        run "mkdir -p #{shared_path}/tmp/dragonfly && ln -nfs #{shared_path}/tmp/dragonfly #{release_path}/tmp/dragonfly"
      end
    end
    after 'deploy:update_code', 'dragonfly:symlink'

Use it!
-------

To see what you can do with the model accessors, see {file:Models}.

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
dragonfly-0.9.15 extra_docs/Rails2.md
dragonfly-0.9.14 extra_docs/Rails2.md
dragonfly-0.9.13 extra_docs/Rails2.md
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md
classiccms-0.5.17 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Rails2.md