h1. Localized @EachValidator@ | *Author* | Tim Morgan | | *Version* | 1.0 (Oct 31, 2010) | | *License* | Released under the MIT license. | h2. About Localized @EachValidator@ is a subclass of ActiveRecord's @EachValidator@ that makes it easier to write a localized validator with Rails 3's localization. It's small and simple. h2. Usage Add this gem to your project's @Gemfile@, or to your own validator gem's dependencies. Then, sublass @LocalizedEachValidator@ and provide the @error_key@ and override the @valid?@ method, like so:

class FourValidator < ActiveRecord::EachValidator
  error_key :must_be_four

  def valid?(record, field, value)
    value == 4
  end
Now, users of your validator can create a localization YAML file like so:

en:
  activerecord:
	errors:
	  messages:
	    must_be_four: This number must be four.
See the {LocalizedEachValidator} class documentation for more information.