lgs / mongoid-carrierwave-uploadify

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails 3, Mongoid, Carrierwave, Uploadify, and Devise

This is a demonstration application using:

  • 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.

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.


Languages

Language:JavaScript 84.6%Language:Ruby 15.4%