- A pg_inet_ops extension has been added, for DSL support for calling
PostgreSQL inet functions and operators. Example:
r = Sequel.pg_inet_op(:inet)
~r # ~inet
r & :other # inet & other
r | :other # inet | other
r << :other # inet << other
r >> :other # inet >> other
r.contained_by(:other) # inet << other
r.contained_by_or_equals(:other) # inet <<= other
r.contains(:other) # inet >> other
r.contains_or_equals(:other) # inet >>= other
r.contains_or_contained_by(:other) # inet && other
r.abbrev # abbrev(inet)
r.broadcast # broadcast(inet)
r.family # family(inet)
r.host # host(inet)
r.hostmask # hostmask(inet)
r.masklen # masklen(inet)
r.netmask # netmask(inet)
r.network # network(inet)
r.set_masklen(16) # set_masklen(inet, 16)
r.text # text(inet)
- The association_pks plugin now supports a :delay_pks association option.
When set to true, this makes the methods created by the plugin usable on
new objects, by delaying the saving of the associated pks until after the
new object has been saved. When set to :always, this also changes the
behavior of the methods for existing objects, so that nothing is persisted
until the object has been saved. Example:
Album.plugin :association_pks
Album.many_to_many :tags, :delay_pks=>true
album = Album.new(:tag_pks=>[1,2,3]) # No database query
album.save # Queries to insert album, and then update albums_tags
- The class_table_inheritance plugin now supports subclasses that don‘t
require additional columns, and therefore do not need to join to additional
tables. It now loads the single_table_inheritance plugin and supports
options that were previously only supported by single_table_inheritance,
such as the :key_map and :key_chooser options.
- The validation_helpers plugin now supports a :from=>:values option in
the validation methods, which will take the value directly from the values
hash instead of calling the related method. This allows validation_helpers
to differentiate between validations on underlying database column and
validations on the model.
The auto_validations plugin has been modified to use this feature, since
all validations it generates are for validations on the underlying database
columns.
- The auto_validations plugin now supports options to pass to each of the
underlying validation methods:
Sequel::Model.plugin :auto_validations,
:unique_opts=>{:only_if_modified=>true}
In addition to :unique_opts, there is support for :not_null_opts (for NOT
NULL columns without a default), :explicit_not_null_opts (for NOT NULL
columns with a default), :max_length_opts, and :schema_types_opts.
- The update_refresh plugin now accepts a :columns option, which specifies
the columns to refresh. This option is currently only respected if the
related dataset supports RETURNING.
- The :timeout option to Database#listen in the postgres adapter can now be a
callable object, previously it had to be Numeric. This allows you to
dynamically change the timeout based on current application state.