Edit:
How to use ActiveRecord::RecordNotFound exception to make Rails respond with the standard 404? The basic approach suggested in many places is to modify the config/application.rb to not require "rails/all", but instead check out the file: railties/lib/rails/all.rb and pick and choose what you want/need. However, if you just leave out the part a about active_record, then you can’t use ActiveRecord::RecordNotFound (and apparently using fixtures might have problems too, I wouldn’t know as I don’t use them). How to solve this problem?
The old explanation of the problem is not very relevant but, I’m leaving it here for reference and context for the comments below..
Old explanation:
So here’s the deal. We have a Rails app that uses MongoHQ as it’s database. Locally thing’s run smoothly without any problems, but on production and staging environments it seems that Heroku insists that we must have postgresql database and gems setup/installed. I’ve tried to delete the addons and related config variables, but it just wont do. This is rather annoying as now the free postgresql causes problems because if we crank up the dynos it will very quickly run out of connections (20 connection limit). However, upgrading to a more production level tier of postgresql seems like a very silly thing to do when the database has 0 tables. How are everyone else using MongoHQ managing this? I can’t seem to be able to find any anything about it though I would have thought it to be an apparent issue that everyone using MongoHQ and Heroku would face?
The key idea is that we can still
require "activer_record", but lets just leave out the corresponding railtie. This is what I ended up putting into myconfig/application.rbCredits for the idea goes to mr. Benjamin Oakes:
http://www.benjaminoakes.com/2011/09/15/activerecordconnectionnotestablished-in-rails-3-1-on-heroku/