404 on 1.5:
module App::Controllers
  class NotFound
    def get(path)
      "Do something with path"
    end
  end
end

404 on 1.9/2.0:
module App
  def r404(path)
    "Do something with path"
  end
end

There appears to be two solutions:
Call ActiveRecord::Base.verify_active_connections! before every request (I
think this is what Rails does by default):

module VerifyConnection
  def service(*args)
    ActiveRecord::Base.verify_active_connections!
  ensure
    return super
  end
end

module App
  include VerifyConnection
end

Or, pass reconnect => true to establish_connection.

I'm not quite sure what's best…

// Magnus Holm


On Fri, Feb 19, 2010 at 20:59, David Susco <dsu...@gmail.com> wrote:

> I have a few camping projects that are about to go into production in
> a few weeks, just picking your brains to see if I can add some
> robustness.
>
> What's the best way to catch any "Camping Problem! /XXX not found"
> errors that a user might see if they start typing URLs themselves?
> Ideally I'd just like to redirect them all to some general index
> controller.
>
> I'm using MySQL for my database. I'm getting a few "MySQL server has
> gone away" error messages every now and then. I did some searching and
> found if "reconnect: true" is in the hash I send to
> establish_connection that I should be all set. Can anyone confirm?
> Also, any other MySQL connection "best practices" that I should be
> following?
>
> --
> Dave
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to