Hi list!

Could someone please explain why the attached code snippet does not
work? I'm pretty new to Sequel, but this just seems weird. I just want
to create self-sustaining models in two different SQLite databases
without using any external *magic* variables. But without the db
variable I get the an error message: "No database associated with
Sequel::Model (Sequel::Error)". Why? And is there anything I could do
about it?

Sincerely

/lasso

<code>
require 'rubygems'
require 'sequel'

# Uncommenting the following line makes the models work. Why?
# db = Sequel.sqlite

class One < Sequel::Model
    self.db = Sequel.sqlite('one.db')
    self.set_schema do
        primary_key :oid
        text :c1
        text :c2
        text :c3
    end
    self.create_table unless self.table_exists?
end

class Two < Sequel::Model
    self.db = Sequel.sqlite('two.db')
    self.set_schema do
        primary_key :oid
        text :c1
        text :c2
        text :c3
    end
    self.create_table unless self.table_exists?
end
</code>
--~--~---------~--~----~------------~-------~--~----~
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