On Feb 11, 11:09 am, "Skye sh...@#$" <[email protected]> wrote:
> I want to embed an object in my model that is composed of some of the
> model's attributes.
> Like ActiveRecord's composed_of.

Ah.  I guess Sequel doesn't support that natively.  It shouldn't be
that difficult to create a plugin for 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.

If I had to do what you wanted, I'd just make a lazy accessor, unless
I knew I would need the history object in every instance:

  class Blog < Sequel::Model
    def history
       @history ||= History.new(dbCreateBy)
    end

    def before_save
       self.dbCreateBy = @history.dbCreateBy if @history
    end
  end

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.

Reply via email to