1.4.0.txt

doc/release_notes/1.4.0.txt
Last Update: 2011-07-16 11:31:03 -0700

Eager loading for all types of associations:

Artist.eager(:albums).all
Album.eager(:artist, :genre, :tracks).all
Album.eager(:artist).eager(:genre).eager(:tracks).all
Album.filter(:year=>2008).eager(:artist).all

Eager loading supports cascading to an unlimited depth, and doesn’t have any aliasing issues:

Artist.eager(:albums=>:tracks).all
Artist.eager(:albums=>{:tracks=>:genre}).all

Unfortunately, eager loading comes at the expense of a small amount of backward compatibility. If you were using uncached associations (the default in sequel_model 0.5), they no longer work the same way. Now, all associations act as if :cache=>true (which is now set for all associations, so if you wrote a tool that worked with both cached and uncached associations, it should still work).

One to many associations now populate the corresponding many to one instance variable (even when eagerly loaded):

# Assuming: Album.one_to_many :tracks
album = Album.first
# This following code is only one query,
# not a query for the album and one for each track
album.tracks.each{|t| puts t.album.name}

ActiveRecord style has_many :through associations are now supported via many_to_many. many_to_many will no longer select the entire result set, just the columns of the associated table (and not the join table), so it works for both has_and_belongs_to_many (simple join table) and has_many :through (join table model) scenarios. If you want to include all or part of the join table attributes, see the :select option for many_to_many associations.

We reduced the number of gems from three (sequel, sequel_core, sequel_model) to two (sequel, sequel_core). Basically, sequel_model is now just sequel, and the old sequel gem metapackage is no longer. There isn’t a reason to have a gem metapackage for two gems when one (sequel_model) depends on the other (sequel_core). This required a version bump for the model part of sequel from 0.5.0.2 to 1.4.0 (since the previous sequel gem version was 1.3).

Sequel 1.4.0 has fixes for 11 trackers issues, including fixes to the MySQL and PostgreSQL adapters.

We have switched the source control repository for Sequel from Google Code (which uses subversion) to github (which uses git). If you would like to contribute to Sequel, please fork the github repository, make your changes, and send a pull request. As before, posting patches on the Google Code issue tracker is fine as well.