This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon May 26 23:59:27 -0700 2008 | [fesplugas] |
| |
README | Sat Jun 28 14:33:36 -0700 2008 | [fesplugas] |
| |
Rakefile | Mon May 26 23:59:27 -0700 2008 | [fesplugas] |
| |
init.rb | Mon May 26 23:59:27 -0700 2008 | [fesplugas] |
| |
lib/ | Fri Oct 03 06:51:09 -0700 2008 | [fesplugas] |
| |
test/ | Sat Jun 28 14:33:01 -0700 2008 | [fesplugas] |
README
== Simplified Constraints
Because adding database constraints should be easy.
Available constraints:
* Email: Validates format of email
* Login: Validates uniqueness of login names
* Positive: Validates positiveness of a number
* Length: Validates length of a value
* Uniqueness
<b>Note:</b> Only works on PostgreSQL. This is an initial work. And I've planned
to add the common Rails validations +validates_format_of+, +validates_inclusion_of+,
+validates_lenght_of+, +validates_numericality_of+, +validates_size_of+,
+validates_uniqueness_of+.
== Example
class AddConstraintsOnModels < ActiveRecord::Migration
def self.up
add_email_check :users, :email
add_login_check :users, :login
add_positive_check :products, :price
add_length_check :users, :login, :is => 8
add_uniqueness_check :user, :login
end
def self.down
remove_email_check :users, :email
remove_login_check :users, :login
remove_positive_check :users, :price
remove_length_check :users, :login, :is => 8
remove_uniqueness_check :user, :login
end
end
== How to test?
$ createdb simplified_constraints
$ rake
Copyright (c) 2008 Francesc Esplugas Marti, released under the MIT license



