Quick Tip: MongoMapper::DocumentNotFound

21 November 2009

If you'd like to get a 404 response when you encounter a MongoMapper::DocumentNotFound error, which is the default response for ActiveRecord::RecordNotFound, simply toss this in your initializer where you set up your Mongo connection (I use config/initializers/mongo.rb):

ActionController::Base.rescue_responses['MongoMapper::DocumentNotFound'] = :not_found



Paperclip and MongoMapper

29 August 2009

I started a new project recently that deals with a lot of imported data, so it seemed like a good excuse to try out MongoDB and MongoMapper. The imported data also has a associated images, so I wanted to get the Paperclip plugin working with my Mongo-based models. Fortunately for me, it actually didn't take too much work to pull out the ActiveRecord-specific bits. Here's what I did...

Read the rest of this entry ยป