Hi, I’m a newbie Sequel user, trying to learn it while developing
a small application (email signature manager/randomiser):
http://github.com/Chastell/signore

I’m sorry if this question was raised before (or is a common knowledge),
I’m on my honeymoon and have very sporadic net access – hence can’t
google as much as I’d want to. :|

My problem is that (a) model definition seems to require an established
database connection and (b) the defined models seem to be tied
(data-wise) to the database they were defined for, even if I switch
connections later.

The second problem can be observed in my application’s specs:
http://github.com/Chastell/signore/blob/ee43252614f14b55a503694cd50058d12117e000/spec/signore/executable_spec.rb
– even though I (seemingly?) reconnect to a :memory: database
in the last two specs, the data from them are being put in the
spec/fixtures/example.db database.

The first problem means I have to use an ugly hack to even
require the model files – the Singore.define_models method in
http://github.com/Chastell/signore/blob/ee43252614f14b55a503694cd50058d12117e000/lib/signore.rb

Any help on (a) how to define models without having to tie them to
a given database and/or (b) how to sanely switch databases with the
models switching over would be most appreciated.

Again, apologies if I’m (hopefully!) missing something
obvious; this is my first Sequel/Amalgalite app.

— Piotr Szotkowski
-- 
In Focus: At Home, Donald Knuth Mows His N × N Lawn With Stunning O(N log N)
Algorithm That He ‘Whipped Up One Morning Over Coffee’       [patentlyfalse]

Attachment: signature.asc
Description: Digital signature

Reply via email to