On Sep 23, 10:27 am, cult hero <[email protected]> wrote: > I know that, by convention, you set some kind of constant like DB to > be your database when connecting. In my first Rails 3 app, I did this > manually with my own initializer that read from the database.yml file. > > However, on a new project I'm working the sequel-rails railtie which > does everything my little initializer did and then some. The trouble > is that I want to use the sequel_postresql_triggers gem as well as > outlined in this thread: > > http://groups.google.com/group/sequel-talk/browse_thread/thread/15326... > > To use it, the README says to do this: > > DB.create_language(:plpgsql) > > The problem is that, I have no idea what constant the railtie creates. > I've been looking through the code, but that didn't bring me any > closer to an answer. Sequel knows though because it's the default DB > for the models. How do I figure out what database Sequel is using as > the default to I can apply this?
Assume your app only uses one database, you can do: DB = Sequel::DATABASES.first Sequel::DATABASES is an array of all databases that have been connected to. Jeremy -- 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.
