On Feb 10, 8:47 pm, Jeremy Evans <[email protected]> wrote:
> On Feb 10, 7:26 pm, "Skye sh...@#$" <[email protected]> wrote:
> > Is there a Sequel way to create a component object for a model?
>
> I'm not sure I understand what you want to do.  You want to select
> from the current dataset, but return an instance of a different
> model?  

I want to embed an object in my model that is composed of some of the
model's attributes.
Like ActiveRecord's composed_of.

> If the History model is just used for the Blog dataset, just do class
> History < Sequel::Model(:blogs), and use the History dataset.

A Blog instance already holds the properties I'm after. Using a
dataset as source for History will caused them to be reloaded from the
DB.

> If the History class is used to get the same behavior in multiple models,
> then don't make it a class, make it a module and extend the necessary
> instances with it.

History needs to remain a class. If a Module were used it'd be doing
something along the lines of what I did with the before_save/
after_initialize callbacks in Blog, which is why I'm here looking for
a Sequel method/style for doing this. Maybe there isn't one.

-Skye



-- 
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