Path: | doc/release_notes/3.27.0.txt |
Last Update: | Fri Oct 06 03:25:22 +0000 2017 |
Album.dataset_module do def with_name_like(x) filter(:name.like(x)) end def selling_at_least(x) filter{copies_sold > x} end end Album.with_name_like('Foo%').selling_at_least(100000).all
Previously, you could use def_dataset_method to accomplish the same thing. dataset_module is generally cleaner, plus you are using actual methods instead of blocks, so calling the methods is faster on some ruby implementations.
Sequel::Model.plugin :prepared_statements_safe
model.exists?
to:
model.this.get(1).nil?