Arext ===== Active Record Extensions. === Validations == validates_constraints This uses the information one can extract from ActiveRecord::ConnectionAdapter::Column to add default validations. The text?, limit and type methods are used to guess what validations are to be added validates_constraints make some assumptions (see below) and none of its behaviour is configurable. (you can always use the standard validations in addition to make some adjustments) * Adds validates_presence_of for columns with not null constraints (unless type is :boolean) * options are added so that empty strings will pass, unlike if you add the validate_presence_of yourself. If you want to have different behaviour then just add a validation yourself * Adds validates_inclusion_of(:in => [true, false]) for columns with not null constraints and :boolean type * Adds validates_length_of for text columns with not null limit == validates_url This validator adds the feature to validate urls with http and https protocols. It also include portnumbers and any subdomains. Instead of a domain name, you can use ip address too (version 4). == validates_host This validator adds the feature to validate a hostname. Instead of a hostname, you can use ip address too (version 4). == validates_email This validator adds the feature to validate a email address. Example ======= == validates_constraints in your ActiveRecord class: validate_constraints(:attribute_name, :other_attribute_name) or validates_constraints() for all attributes == validates_url in your ActiveRecord class: validates_url(:attribute) == validates_host in your ActiveRecord class: validates_host(:attribute) == validates_email in your ActiveRecord class: validates_email(:attribute) Copyright (c) 2008 - now [simplificator gmbh]