Mongo

Dragonfly can be used with any ActiveModel-compatible model, therefore libraries like Mongoid work out of the box.

Furthermore, Mongo DB has support for storing blob-like objects directly in the database (using MongoDB 'GridFS'), so you can make use of this with the supplied MongoDataStore.

For more info about ActiveModel, see Models.

For more info about using the Mongo data store, see DataStorage.

Example setup in Rails, using Mongoid

In config/initializers/dragonfly.rb:

require 'dragonfly'

app = Dragonfly[:images]

# Get database name from config/mongoid.yml
db = YAML.load_file(Rails.root.join('config/mongoid.yml'))[Rails.env]['database']

# Configure to use ImageMagick, Rails defaults, and the Mongo data store
app.configure_with(:imagemagick)
app.configure_with(:rails) do |c|
  c.datastore = Dragonfly::DataStorage::MongoDataStore.new :database => db
end

# Allow all mongoid models to use the macro 'image_accessor'
app.define_macro_on_include(Mongoid::Document, :image_accessor)

# ... any other setup, see Rails docs

Then in models:

class Album
  include Mongoid::Document

  field :cover_image_uid
  image_accessor :cover_image

  # ...
end

See Models for more info.