How to reconnect to the database?

I have a rails app that uses a background process. Every now and then,
for a reason beyond me, it will say “Product id=7 not found”. When the
product is in the DB. So What I’d like to do is catch that exception and
then reconnect to the database. Hwo do I do this? I saw a reconnect!
method, but I have no idea which object to run that on how how to
actually use it.

Here is where I saw it:

http://api.rubyonrails.com/classes/ActiveRecord/ConnectionAdapters/AbstractAdapter.html#M000753

Do I just do Product.reconnect!, ha ha. I know that’s not right, but how
do I use that reconnect! method?

Thanks for your help.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs