I've also experienced this and I can confirm that it also happens with
the native mysql bindings.

IIRC the way Rails handles this is to check whether a connection is
active before the start of every request. However it isn't handled
internally by Active Record.

I solved the problem by putting something like this in a before filter
on Application (where Model can be any model class in your app)

    unless Model.connection.active?
      Model.connection.reconnect!
    end

This unfortunately causes a slight bit of extra latency (but only
really noticeable if you're using a remote MySQL server.

Just a disclaimer: this fix has been in for several months and has
worked great. However I haven't removed it recently to see whether the
default merb behaviour has changed.

Hope this is useful,

Martyn

On Tue, Oct 28, 2008 at 10:37 AM, Steve Tooke <[EMAIL PROTECTED]> wrote:
>
> Thanks for your reply Julian.
>
> On 28 Oct 2008, at 10:12, Julian Leviston wrote:
>>
>> I think this usually happens when you don't have the ruby-mysql
>> bindings in place... but it's also something to do with versions
>> sometimes, and also something to do with the mysql socket symlink or
>> something.
>>
>> Was that vague enough for you? ;-)
>
> No that's a great starting point. I'm wondering if it might be because
> I have the mysql gem bundled with my app? It seems possible that this
> might not be building properly on the server with a thor
> merb:gems:redeploy - so perhaps I should just have it installed in the
> servers system gems.
>
> Cheers,
> Steve
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to