I have some models that are all are wrapping a particualr db, so I made a gem and stuck them in it. Then I have two projets that use the gem to talk to the database through these Sequel models. When requiring the gem I load all the models. And I guess, thinking about it now, I could set up a database first and then require the gem ( ie the models ) but I at first thought that was cheezy, and wanted to be able to require the gem at the top of the script and then set the db later on. So, I think I will change to that style. But its tricky cause then requiring the models has that dependency on needing the DB, and I wanted to be able to require the models without any dependency.
~ Daniel On Jan 13, 11:40 am, Jeremy Evans <[email protected]> wrote: > On Jan 13, 8:14 am, daniel_spaniel <[email protected]> wrote: > > > Hi, > > > I was wondering if there is a way to declare a class as a > > Sequel::Model and not necessarily have it have a database set up until > > later ( when I actually issue a query against model. > > No, there is not. You have to setup your database connection first, > as it is during class initialization that Sequel introspects the > database. This isn't generally problematic, why would you need to > define the models first? > > 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.
