Maybe, but does that benefit you?  Constants aren't allowed to be set
more than once (when you first define them), so using one as a DB
connection might potentially cause problems if you ever reset it.
It's also "unfashionable" in Ruby land to use constants over instance
variables for this work.

-- Eric

On 1/26/07, James <[EMAIL PROTECTED]> wrote:
> On 1/26/07, Lennon Day-Reynolds <[EMAIL PROTECTED]> wrote:
> > That way, your connection will only be established once per model
> > class, and will stay open between requests. Alternately, you could set
> > @@dbh instead of @dbh, which would open just one connection for all
> > your model classes, but you might have problems handling multiple
> > simultaneous requests through a single active database handle.
>
> Thanks, I learned something new!  Would it be okay to use a constant
> DBH to represent the database handle?
>
> James
> _______________________________________________
> Camping-list mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to