Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jun 1, 2010
  1. Bump version to 3.12.0

    authored
Commits on May 30, 2010
Commits on May 29, 2010
  1. Fix typo, from dreinull

    authored
Commits on May 28, 2010
  1. Make sure model dataset and dataset mutation methods are created for …

    authored
    …order_append and order_prepend
  2. Add a :join_table_block many_to_many association option used by the a…

    authored
    …dd/remove/remove_all methods
    
    This is useful if the association filters on columns in the join table
    and you want to respect those filters when adding and removing
    objects from the association.
Commits on May 27, 2010
  1. Add an AssociationPks plugin that adds association_pks and associatio…

    authored
    …n_pks= methods for *_to_many associations
    
    These methods allow you to get the primary keys for all associated
    objects, and to modify which objects are associated by passing an
    array of keys to the setter.  The setter will add entries from the
    array that are not already associated, and remove already associated
    entries that are not in the array.
    
    This is a fairly low level plugin that operates at the dataset
    level and does not instantiate model objects.  This is faster but
    it means that callbacks will not be called.  Also, this only
    works with single primary keys, not composite primary keys.
  2. Make Model#checked_transaction private method argument optional, and …

    authored
    …use it in the one_to_one setter method
Commits on May 26, 2010
  1. Add a UpdatePrimaryKey plugin that allows you to update the primary k…

    authored
    …ey of a model object
    
    This plugin just caches a copy of the primary key values when the
    object is loaded from the database, and uses the cached copy
    until after the object is saved, so that if you modify the primary
    key value, it will use the previous value in the UPDATE WHERE
    clause, and the new value in the SET clause.
    
    This causes a substantial performance hit when loading model
    objects, though the model load time is is generally small compared
    to time spent in the lower levels of the stack.
  2. Only remove primary key values when saving all columns if they have n…

    authored
    …ot been modified
    
    Before, Sequel unconditionally removed primary key columns when
    saving existing objects in all cases.  However, if you pass the
    primary key column directly to save, it makes sense for Sequel
    to include it in the update statement.  Likewise, it makes
    sense for Sequel to include it if you use save_changes and it
    has been changed.
    
    Sequel used to always use all columns in a regular save, but
    some databases such as MSSQL have problems with that, as they
    don't allow you to modify the value of an identity column,
    even to set it to the value it already has.  That's the reason
    Sequel started removing primary keys from update statements in
    the first place.  Now, Sequel only removes primary key columns
    from the update values if the columns haven't been modified,
    which should fix the issue.
    
    Note that this does not mean you can update primary key values
    and save objects and have things work correctly.  It's almost
    enough, but to do it properly requires saving existing values
    of the primary keys when loading the object, which slows the
    loading process down by a factor of 3:
    
    h = {:a=>1}
    puts Benchmark.measure{100000.times{b.load(h)}}
    =>  0.540000   0.030000   0.570000 (  0.574908)
    puts Benchmark.measure{100000.times{c.load(h)}}
    =>  1.650000   0.130000   1.780000 (  1.787350)
    
    That's definitely an unacceptable slow down, so that will have
    to go into a plugin.
Commits on May 25, 2010
  1. Add eager loading via .eager support to the sharding plugin

    authored
    This means that when you do:
    
      Sequel::Model.plugin :sharding
      albums = Album.server(:s1).eager(:artist).all
      album.first.artist.save
    
    It will load the albums and artists from shard :s1 and  save the
    artist on shard :s1.
  2. Allow the :eager_loader association proc to accept a single hash inst…

    authored
    …ead of 3 arguments
    
    The previously supported API of using 3 separate arguments is still
    supported.  However, the new API is more flexible, and is required
    to get access to the dataset that is doing the eager loading.  That
    will be used in the future to make sure the sharding plugin works
    for eager loading.
    
    With the new API, the hash passed to the eager_loader proc is
    populated with the keys :key_hash, :rows, :associations, and
    :self, with the first three keys corresponding to the old
    argument order, and the new :self key being the dataset doing
    the eager loading.
    
    The Model.eager_loading_dataset method now also accepts an
    options hash as an optional fifth argument, which should be
    backwards compatible.
  3. Move to using explicit methods instead of aliases for methods that ca…

    authored
    …n be overridden in subclasses
    
    Aliasing a method in ruby does not create a method that calls
    another method, it creates a method with the same body as another
    method.  Sometimes that is what you want, but in Sequel we often
    want a method that calls the original method, so that if the
    original method is overridden in a subclass, calling the alias
    calls the overridden method instead of the default method.
    
    This changes Sequel to use explicit methods instead of aliases
    for methods that could be overridden in subclasses.
  4. Add a Dataset#order_prepend method that adds to the end of an existin…

    authored
    …g order
    
    This is useful if the dataset is already ordered, and you want to
    modify the order, but still keep the original order as the fallback.
    Example:
    
      # Dataset ordered by albums name
      ds = DB[:albums].join(:artists, :id=>:artist_id).
             order(:albums__name)
      # You want to order it by artists, but keep the existing
      # order by album for albums by the same artist
      ds.order_prepend(:artists__name)
  5. Add a Sequel::NotImplemented exception class, use instead of NotImple…

    authored
    …mentedError
    
    This modifies some default methods that are overwritten in all
    adapters to use a Sequel::NotImplemented exception class.  It
    also adds the tables and indexes method that are implemented by
    many of the adapters to the main Database class, and has them
    raise Sequel::NotImplemented.
    
    This also modifies the indexes methods in some of the adapters
    to take an options hash, even though they don't use it, for
    consistency with the JDBC adapter and now the default method
    signature.
  6. Correctly handle more than 2 hierarchy levels in the single table inh…

    authored
    …eritance plugin
    
    Previously, Sequel did not handle more than 2 hierarchy levels in
    the single table inheritance plugin.  If you were using more than
    two levels, the documentation told you that you had to set up your
    own custom filter.
    
    With this change, you can now have as many class hierarchy levels
    as you want, and Sequel will handle things automatically.
    
    There shouldn't be any backwards compatibility problems, but this
    does switch subclasses to use IN instead of = in their filter. That
    may have performance implications, but any decent database is going
    to treat an IN with one element the same as an =, so there should
    not be any performance regression in the 2 level hierarchy case.
  7. Allow using a custom column value<->class mapping to the single_table…

    authored
    …_inheritance plugin
    
    This allows you to configure the mapping used.  The default mapping
    remains the same, where the column value holds the name of the class
    as a string.  However, you can now provide a mapping that allows you
    to use integers, non-class name strings, or pretty much anything, to
    map the column values for strings.
    
    The most common customization is probably to use integers, which can
    be easily done with a hash:
    
      Employee.plugin :single_table_inheritance, :type,
        :model_map=>{1=>:Staff, 2=>:Manager}
    
    You can also use a pair of custom procs:
    
      Employee.plugin :single_table_inheritance, :type,
        :model_map=>proc{|v| v.reverse},
        :key_map=>proc{|klass| klass.name.reverse}
    
    Check the new module RDoc for details.
  8. Remove cached schema entry when creating table

    authored
    This fixes some corner cases, such as using raw SQL to drop a table
    or dropping a table in another process.  However, it's safe as any
    time create_table succeeds, any previous cached schema entry is
    probably invalid.
Commits on May 24, 2010
Commits on May 21, 2010
  1. Make sure certain alter table operations clear the schema correctly o…

    authored
    …n MySQL (Fixes #301)
    
    This changes the order of operations so that the schema cache is
    cleared after the alter table operations instead of before.  So if
    any code needs to check the existing schema inside the alter table
    operation, it won't cache a previous schema entry that is then
    invalid after the alter table call.
Commits on May 20, 2010
Something went wrong with that request. Please try again.