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
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 <dsusco at 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 at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20100219/b11a7771/attachment.html>
Thanks on the 404 stuff, that was easy. I''m going to stick with the reconnect => true until that is proving not to work. It''s the easiest as it''s a one liner addition to my yaml. Dave On Fri, Feb 19, 2010 at 3:13 PM, Magnus Holm <judofyr at gmail.com> wrote:> 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 <dsusco at 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 at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Dave