I'm trying to define, as generically as possible, a bunch classes in gems 
that will work together as a Sinatra application. Let's say the Sinatra app 
is going to be in "myapp.rb" and my classes are in a "my_classes" gem. I 
would expect in myapp.rb to be able to:

1) require my_classes
2) open a database connection
3) run off to the races...

The snag that I'm running into is that when you write, in my_classes.rb, 
say:

   class MyClass < Sequel::Model[:mytable]

Sequel expects to have a connection already open at "compile time."  This 
means that you can't put "require 'sequel'" in my_classes.rb It seems you 
have to do the following steps in the myapp.rb:

1) require sequel
2) open the database connection
3) require my_classes

Not a big deal but it doesn't seem like the cleanest pattern. Is there some 
other way that I'm missing?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/9qeD8_stSv4J.
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