Sequel version 0.4.5 has just been released. Sequel is a lightweight
database access and ORM library for Ruby. Sequel provides thread
safety, connection pooling and a simple and expressive API for
constructing database queries and table schemas.
This release includes new model validations and a few minor bug fixes
and improvements. Here are the changes:
=== New model validations
Sequel now includes support for validations in models. The validations
functionality is based on the Validatable gem (http://
validatable.rubyforge.org), which needs to be installed if validations
are to be used. Validations can be defined in two forms. First there
is the validates method, which takes a block:
class User < Sequel::Model(:users)
validates do
format_of :email, :with => /somewhackyregexp/
presence_of :name
...
end
end
You can also invoke all the validate_xxx methods supported by
validatable directly:
class User < Sequel::Model(:users)
validates_format_of :email, :with => /somewhackyregexp/
validates_presence_of :name
end
To check if an instance is valid you can call the #valid? method:
user.valid?
To check if a model class has defined validations you can invoke
has_validations?:
User.has_validations?
=== Other changes
* Fixed update_sql with array sub-item keys (#110).
* Added Model#update as alias to #set.
* Added Database#set_column_default method (thanks Jim Morris.)
* Added rdoc for new alter_table functionality (#109).
* Refactored model specs.
* Removed warning on uninitialized @transform value (thanks Jim
Morris).
=== More info
Sequel project page:
<http://code.google.com/p/ruby-sequel>
Sequel documentation:
<http://sequel.rubyforge.org>
Join the Sequel-talk group:
<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 sequel
cd sequel
rake install