Skip to content

Rails 3.0, Mongoid ORM, Carrierwave Uploader, and Uploadify demonstration app.

Notifications You must be signed in to change notification settings

dpsk/mongoid-carrierwave-uploadify

 
 

Repository files navigation

Rails 3, Mongoid, Carrierwave, Uploadify, and Devise

This is a demonstration application using:

  • Ruby 1.9.2 — Best programming language
  • Rails 3.0 — Best web framework ever
  • Mongoid — A MongoDB mapper for Rails
  • Carrierwave — Upload and attach files to Rails models
  • Uploadify — Flash based multi-file uploader
  • Devise – Rack based authentication

Other depedencies:

  • RSpec 2.0 — Works well with Mongoid
  • JQuery 1.4.1 — Prototype replacement, required by Uploadify
  • jQuery-UI 1.8.4 — Used for drag and drop sorting of photos
  • HAML — Much better than writing in ERB
  • RemarkableMongoid — Very useful in testing standard Mongoid associations

Bonus:

  • Configuration to use Amazon S3

Uploadify

http://www.uploadify.com/

JQuery plugin that uses SWFObject to easily select and upload multiple files. Sensible defaults, good looking default buttons, excellent callback mechanism.

This project adds rack middleware to correctly pass session data into Rails as well as properly handle Javascript calls using respond_to. It also uses RJS to dynamically update the browser as each image is uploaded and a thumbnail is created.

NOTE: There is a Rack middleware located in lib/include that needs to be inserted into the Rails session chain. Take note of adding the directory that contains the middleware to your application.rb’s autoload_paths. Also, look in config/initializers/session_store.rb to see how to insert the FlashSessionCookieMiddleware.

Carrierwave

http://github.com/jnicklas/carrierwave

Uploading mechanism using Rack Middleware to handle accept uploads and “mount” them to the model. Carrierwave is best at isolating all uploading functions from the model it’s being attached to. Image is the mount point inside the photo model. The photo model is an embedded document inside the story model.

Mongoid

http://mongoid.org/

Mongoid is an excellent (and we think the best) ORM for MongoDB. It enables embedded documents as well as ActiveRecord style associations (called references). The documentation is good and is actively developed. It does not interfere with ActiveRecord so projects can use both in parallel.

Devise

http://github.com/plataformatec/devise

Authentication system using Warden rack middleware. Integrates with Mongoid. Base project has authentication disabled. To enable authentication, uncomment “before_filter :authenticate_user!” in application_controller.rb

jQuery

The jQuery UJS project for Rails lists 1.4.1 as the recommended version for Rails 3.0.

Amazon S3

App includes configuration to use S3 for production, :file for development, and :file without processing in test mode. See config/initializers/carrierwave.rb for details.

More

  • Stores photo width and height
  • Stores photo orientation
  • Live photo sorting using jQuery sortable

About

Rails 3.0, Mongoid ORM, Carrierwave Uploader, and Uploadify demonstration app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published