Sha256: d852a9d4511c8e23a61050e642c3aac14a4559899d0c286a6c6f7a0a00269421

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

require 'rack/cache'
require 'dragonfly'

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

if defined? ActiveRecord::Base
  app.define_macro(ActiveRecord::Base, :image_accessor)
end

if defined? Mongoid::Document
  require 'mongoid'

  mongo_yml_path  = Rails.env.test? ? "#{File.expand_path('../../../../test/dummy/config', __FILE__)}" : "config"
  yaml_file       = YAML.load_file(File.join(mongo_yml_path, 'mongoid.yml'))[Rails.env]

  app.datastore = Dragonfly::DataStorage::MongoDataStore.new
  app.datastore.configure do |c|
    c.host      = yaml_file['host']                 # defaults to localhost
    c.port      = yaml_file['port']                 # defaults to mongo default (27017)
    c.database  = yaml_file['database']             # defaults to 'dragonfly'
    c.username  = yaml_file['username']             # only needed if mongo is running in auth mode
    c.password  = yaml_file['password']             # only needed if mongo is running in auth mode
  end

  app.define_macro_on_include(Mongoid::Document, :image_accessor)
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
attachment_magick-0.3.3 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.3.2 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.3.1 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.3 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.2.7 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.2.6 lib/attachment_magick/dragonfly/init.rb
attachment_magick-0.2.5 lib/attachment_magick/dragonfly/init.rb