You are here: Browse Railsplugins If Validators
This generates methods to keep your errors class clean. So that it does not tell the users that the title is blank and is not unique at the same time if specified. Those two within the scope of the project are mutually exclusive.
It automagically goes through each column name and builds these methods if you call has_validator. However, you can also specify other columns using a symbol or string.
For the next version of this plugin, I will hang onto method_missing for a larger array of options IF I get enough requests.
class Post < ActiveRecord::Base attr_accessor
has_validators :my_accessor
validates_presence_of :title
validates_uniqueness_of :title, :if => :title_is_not_nil
validates_presence_of :excerpt, :if => :message_is_not_nil
Copyright© 2008 Zach Inglis, released under the MIT license
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly