On Mar 20, 3:08 pm, Jeremy Evans <[email protected]> wrote: > Is there a reason you are not able to provide correct > parameters when the model class is defined?
The dataset is not known when the model class is defined because I cannot define classes inside of a method, and I am attempting to programmatically automate the tear-down and build-up of the database and database schema. For instance: https://gist.github.com/879582 To work around this, I would have to do either of two things: 1.) Run at least two separate processes in order -- one responsible for database+schema setup/tear-down routines, and another responsible for defining the model class(es), specifying the dataset(s), and test execution; 2.) After database+schema setup/tear-down, require a separate source file defining the model class(es), datasets, and plugins. I would like to have both set of routines available in one require- able file, and execute them all at once. This would simplify the program structure, and make it easier for me to create single executable ruby scripts that are capable of performing database demos like the one in the gist. I was looking at the source code for the Sequel::Model(source) method in model.rb, and it appears that I will have to override this method somehow, so that if a model class is defined without a dataset explicitly specified, then it will do nothing except allow the class to be defined. If this can be accomplished then it appears that I should be able define the dataset for the model at my discretion. I would prefer to override the Sequel code as little as possible, but it appears my preferences are at odds with Sequel's preferences. :-) -Nels -- 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.
