<div>404 on 1.5:<br><div>module App::Controllers</div><div> class NotFound</div><div> def get(path)</div><div> "Do something with path"</div><div> end</div><div> end</div><div>end</div><div><br></div>
<div>404 on 1.9/2.0:</div><div>module App</div><div> def r404(path)</div><div> "Do something with path"</div><div> end</div><div>end</div><div><br></div><div>There appears to be two solutions: Call ActiveRecord::Base.verify_active_connections! before every request (I think this is what Rails does by default):</div>
<div><br></div><div><div>module VerifyConnection</div><div> def service(*args)</div><div> ActiveRecord::Base.verify_active_connections!</div><div> ensure</div><div> return super</div><div> end</div><div>end</div>
<div><br></div><div>module App</div><div> include VerifyConnection</div><div>end</div><div><br></div><div>Or, pass reconnect => true to establish_connection.</div><div><br></div><div>I'm not quite sure what's best…</div>
</div></div><div><br></div><div>// Magnus Holm<br>
<br><br><div class="gmail_quote">On Fri, Feb 19, 2010 at 20:59, David Susco <span dir="ltr"><<a href="mailto:dsusco@gmail.com">dsusco@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I have a few camping projects that are about to go into production in<br>
a few weeks, just picking your brains to see if I can add some<br>
robustness.<br>
<br>
What's the best way to catch any "Camping Problem! /XXX not found"<br>
errors that a user might see if they start typing URLs themselves?<br>
Ideally I'd just like to redirect them all to some general index<br>
controller.<br>
<br>
I'm using MySQL for my database. I'm getting a few "MySQL server has<br>
gone away" error messages every now and then. I did some searching and<br>
found if "reconnect: true" is in the hash I send to<br>
establish_connection that I should be all set. Can anyone confirm?<br>
Also, any other MySQL connection "best practices" that I should be<br>
following?<br>
<font color="#888888"><br>
--<br>
Dave<br>
_______________________________________________<br>
Camping-list mailing list<br>
<a href="mailto:Camping-list@rubyforge.org">Camping-list@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/camping-list" target="_blank">http://rubyforge.org/mailman/listinfo/camping-list</a><br>
</font></blockquote></div><br></div>