Last Update: 2015-07-01 08:05:45 -0700

New Features

  • 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,

    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.

Other Improvements

  • The uniqueness validations added by the auto_validations plugin now use a symbol key in the related Errors instance if the underlying index was on a single column. Previously, the uniqueness validations for a single column would use an array key in the related Errors instance.

  • The jdbc subadapters now correctly handle 64-bit autoincrementing primary keys.

  • The jdbc subadapters now work correctly if they issue queries while the subadapter is being loaded. This can happen in the jdbc/postgresql adapter if the pg_hstore extension is used.

Backwards Compatibility

  • The deprecated db2 and dbi adapters have been removed.