Skip to content

DimaSamodurov/refile-mongoid

Repository files navigation

Integrate Refile with Mongoid.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'refile-mongoid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install refile-mongoid

Usage

Se original Refile documentation for usage.

You just do not need to create a database migration as attachment id field is defined automatically on the model.

Using attachments within Embedded documents

Because storing/deleting of files is triggered by callbacks, you might want to specify cascade_callbacks: true for your embedded associations e.g:

class Photo
  include Mongoid::Document
  attachment :image
end

class Album
  include Mongoid::Document
  embeds_many :photos, cascade_callbacks: true
end

See MongoID doc

Testing

$ rake

About

Refile integration with Mongoid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages