On Friday, May 25, 2012 1:28:43 PM UTC-7, Michael Granger wrote: > > On Saturday, April 28, 2012 11:07:20 AM UTC-7, Johnny wrote: > > >> How can I extend Sequel::Model? Every Sequel::Model subclass requires >> a table, but I want all the models in my application to inherit from >> one class, which won't have a backing table. How can I do this? >> > > Even though it's an unsupported use, subclassing Sequel::Model works quite > well if you're careful. I do it in several projects in which I want to use > Sequel::Model, but I can't know where the database is until runtime (e.g., > connect info is in a config file, etc.). >
This is probably different from what the original poster is asking. In your case, your model has a backing table, it just isn't known until runtime. He appears to be requesting a way to use a model without a backing table at all. Note that the recommended way to handle your case, is to not require the file containing your model class until runtime. Basically, requiring your library doesn't require you the file containing your model class. Instead, whenever you would normally call the #db= method on your model, change that to call a method that requires the file containing your model class. It probably is possible to use Sequel::Model completely without a model class if you do some hacking, but I don't support that. I'm not sure why you'd want to do that anyway. If the original poster could better explain their use case, I could probably recommend an alternative. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/DuoN__-M4OUJ. 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.
