On Apr 19, 6:09 pm, Nate Wiger <[email protected]> wrote:
> There is stuff like this which is
> surprising:http://groups.google.com/group/sequel-talk/browse_thread/thread/74042...
That changed a long time ago (that thread was from 2008). Now
save_changes saves columns modified in before_save. However, if you
don't make any changes at all, save_changes will still do nothing
instead of attempting to save.
> While not a "new feature" I do think there is still room to improve
> *existing* features of Sequel, especially when Sequel offers very
> similar functionality to other ORM's, but has subtleties in its
> behavior which can result in unexpected application bugs.
I suppose that is true with all complex software. When possible, such
undesired behavior should be fixed, and if not possible to fix neatly,
it should certainly be documented.
> Also, def_dataset_method and other def_ friends are a bit obtuse; a
> more friendly "scope" or equivalent term would be nice. They sound
> like internal methods I'm not supposed to use as an end-user.
Well, subset already performs what I think scope would perform, and I
think subset is a better name. def_dataset_method accurately
describes what is does, while scope does not:
def Album < Sequel::Model
subset(:gold){copies_sold > 500000}
def_dataset_method(:forty_two){42}
end
There's nothing saying that def_dataset_method has to return a
modified dataset, even though that's what it is most commonly used
for. All def_dataset_method does is add a method to the model's
dataset, which is why I think def_dataset_method is a good name.
Most of the other def_ methods are private and probably shouldn't be
used directly, other than maybe def_mutation_method, which should be
used if you add your own dataset methods and want to create mutation
versions of them.
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.