On Jan 24, 9:54 am, Glen <[email protected]> wrote: > I have the following Model: > > module DB > LOCAL = Sequel.sqlite("#{File.expand_path("../../../../db/ > janitor.db", __FILE__)}") > > class User < Sequel::Model > > class << self > def create_table > LOCAL.create_table? :users do > String :login > String :id > String :first_name > String :last_name > primary_key :login > end > end > > def delete_table > LOCAL.drop_table(self.table_name) > end > > def no_role > Net::LDAP::Filter.present("uid") & > Net::LDAP::Filter.negate(Net::LDAP::Filter.present("pdsrole")) > end > end > end > end
I don't see where you are actually creating/dropping the table. You have methods that do so, but those methods don't appear to be called anywhere. Even if they are called (as you say later), you need to make sure the model picks up the changes, which you can do by User.dataset = User.dataset. You could use the schema plugin to do something similar to what you are doing. However, my usual recommendation is just to do any schema modification stuff before creating the model class (i.e. above the User < Sequel::Model line), so you don't need to worry about it. 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.
