# ANN: Sequel 0.1.7 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-0-1-7-released/108240>\
**Category:** Ruby\
**Created:** [June 30, 2007, 9:17pm UTC](https://www.ruby-forum.com/t/ann-sequel-0-1-7-released/108240 "2007-06-30T21:17:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciconia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@ciconia](https://www.ruby-forum.com/u/ciconia)\
**Post date:** [June 30, 2007, 9:17pm UTC](https://www.ruby-forum.com/t/ann-sequel-0-1-7-released/108240/1 "2007-06-30T21:17:57Z")

</div>

Sequel version 0.1.7 has just been released. This is mainly a bug fix  
release, but there is also some new functionality, mainly convenience  
methods, and a new pagination feature. Following is a discussion of  
the main changes:

# Pagination

If you’re using Sequel in an MVC setting you might find this one  
useful. A new Dataset#paginate method provides a very simple  
pagination interface. Here’s a contrived example:

def search  
@recipes = Recipe.filter(‘body LIKE ?’,  
params[:search]).paginate(params[:page], params[:page\_size])  
end

What you get back from #paginate is just a regular dataset, but with  
the following methods:

@recipes.page\_count #=\> the total number of pages available  
@recipes.current\_page #=\> the current page number  
@recipes.prev\_page #=\> the previous page number or nil if we’re on  
the first page  
@recipes.next\_page #=\> the next page number or nil if we’re on the  
last page

# Dataset#[]= for updating records

New shorthand for conditional UPDATEs. Instead of:

items.filter(:group\_id =\> 29).update(:stamp =\> Time.now)

You can now write:

items[:group\_id =\> 29] = {:stamp =\> Time.now}

# More concise first and last calls

Dataset#first and Dataset#last now accept hashes for specifying  
filters, so now you can drop the filter call. Instead of:

people.filter(:name =\> ‘sharon’).first

You can now write:

items.first(:name =\> ‘sharon’)

# More concise opening of databases

Sequel now defines a Sequel method call, so instead of:

DB = Sequel.open ‘sqlite:/’

You can now write:

DB = Sequel(‘sqlite:/’)

# Bug fixes

- Implemented Model.join method to restrict returned columns to the  
model table (thanks Pedro Gutierrez).

- Fixed after\_destroy hook to actually work.

- Fixed Dataset#first to include a LIMIT clause for a single record.

- Small fix to Postgres driver to return a primary\_key value for the  
inserted record if it is specified in the insertion values (thanks  
Florian Aßmann and Pedro Gutierrez).

- Fixed Symbol#DESC to support qualified notation (thanks Pedro  
Gutierrez).

======================

Sequel documentation:  
[http://sequel.rubyforge.org](http://sequel.rubyforge.org)

Join the Sequel-talk group:  
[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)

Install the gem:  
sudo gem install sequel

Or check out the source and install manually:  
svn co [http://ruby-sequel.googlecode.com/svn/trunk](http://ruby-sequel.googlecode.com/svn/trunk) sequel  
cd sequel  
rake install
