On Dec 30 2008, 4:46 pm, "spox" <[email protected]> wrote:
> class MyModel < Sequel::Model
> end
>
> class MyOtherModel < Sequel::Model
> end
>
> con1 = Sequel.connect(...)
> con2 = Sequel.connect(...)
>
> MyModel.db = con1
> MyOtherModel.db = con2

That doesn't really work.

$ irb
>> require 'sequel'
=> true
>> class Foo < Sequel::Model
>> end
Sequel::Error: No database associated with Sequel::Model

As far as I can tell, the moment you inherit from Sequel::Model you
must already have a connection. Sure, it doesn't have to be the
*right* one (though it will send DESCRIBE `foos` and SELECT * FROM
`foos` LIMIT 1 to it) because you can override/change it later, but it
must still be there. Is that really a necessary requirement?

I'm working on a Merb app connected to three different database
servers, and it's bugging me that I can't find a way to decouple the
model declarations from the connections.


--~--~---------~--~----~------------~-------~--~----~
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