On Oct 14, 12:43 pm, Phrogz <[email protected]> wrote:
> On Oct 14, 12:50 pm, Jeremy Evans <[email protected]> wrote:
>
> > For pure filters, Model.subset is a shortcut:
>
> > class Account < Sequel::Model
> > subset(:active, :is_active => 1)
> > subset(:admin, :account_type_id => 3)
>
> > def_dataset_method(:by_newest_reg) do
> > order(:registration_date.desc)
> > end
> > end
>
> Out of curiosity, is this only a convenience during coding, or are
> there performance or simplicity benefits? Is #subset just sugar to
> define a dataset method?
It's just sugar:
def subset(name, *args, &block)
def_dataset_method(name){filter(*args, &block)}
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
-~----------~----~----~----~------~----~------~--~---