I created a file called connect_sequel.rb under config/initializers
with the following code:

require 'sequel'
DB = Sequel.connect(YAML.load(File.read(File.join(::Rails.root,'config/
database.yml')))[::Rails.env])

That seems to work well. I had previously put it in config/
environment.rb right before the call to Application.initialize! which
also seemed to work but maybe isn't the best place?


On Jan 12, 12:06 pm, Don Morrison <[email protected]> wrote:
> Jason,
>
> Best place is in an initializer.
>
> Don
>
> On Jan 12, 2011, at 10:51 AM, Jason Thomas wrote:
>
>
>
>
>
>
>
> > Where is the recommended place to initialize the Sequel database
> > connection in a Rails app? Initially I was doing it in the model but
> > once you have more than one model that doesn't make sense. Basically
> > where do I put this line:
>
> > DB = Sequel.connect(YAML.load(File.read(File.join(::Rails.root,'config/
> > database.yml')))[::Rails.env])
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sequel-talk" 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 
> > athttp://groups.google.com/group/sequel-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en.

Reply via email to