Path: | doc/release_notes/4.36.0.txt |
Last Update: | Sat Jun 02 02:04:22 +0000 2018 |
A :class_namespace association option has been added to make it possible to set a default namespace for the :class option if given as a symbol or string.
Sequel::Model.Model.cache_anonymous_models has been added and controls whether to cache anonymous model subclasses created by Sequel::Model::Model() on a per-class basis.
These changes are designed to make it easier to use namespaced models, for example:
module Foo Model = Class.new(Sequel::Model) Model.def_Model(self) DB = Model.db = Sequel.connect(ENV['FOO_DATABASE_URL']) Model.plugin :prepared_statements Model.default_association_options[:class_namespace] = 'Foo' class Bar < Model # Uses Foo::DB[:bars] as dataset # Implicitly uses Foo::Baz as associated class one_to_many :bazes # Uses Foo::Baz due to :class_namespace option one_to_many :oldest_bazes, :class=>:Baz, :order=>:id end class Baz < Model(:my_baz) # Uses Foo::DB[:my_baz] as dataset # Implicitly uses Foo::Bar as associated class one_to_many :bars # Uses Foo::Bar due to :class_namespace option one_to_many :oldest_bars, :class=>:Bar, :order=>:id end end
DB.extension :string_agg ds = DB[:table] ds.get(Sequel.string_agg(:c)) # ',' default separator ds.get(Sequel.string_agg(:c, ' - ')) # custom separator ds.get(Sequel.string_agg(:c).order(:bar)) # force order ds.get(Sequel.string_agg(:c).distinct) # remove duplicates
Sequel.function(:foo, :bar).order(:baz) # foo(bar ORDER BY baz)
Sequel 4.41.0 (to be released in December), will drop support for using the Bignum class as a generic type. This is being done before the release of ruby 2.4 to hopefully make it unlikely that users will be subject to a behavior changes when upgrading ruby versions.
Related to this change, external adapters need to switch from overriding Database#type_literal_generic_bignum to Database#type_literal_generic_bignum_symbol.