Provides simple UUID validation via an ActiveModel::EachValidator. Uuid is not capitalised as ActiveModel's “magic” cannot find the validator if it is.

Methods
V
Instance Public methods
validate_each( record, attribute, value )

Any field this validator is applied to is considered valid if it is nil or a valid UUID. In the case of UUIDs which should not be nil, a separate validation must be added.

Example:

class SomeModel < ActiveRecord::Base
  validates :somefield, uuid: true
end
# File lib/hoodoo/active/active_model/uuid_validator.rb, line 32
def validate_each( record, attribute, value )

  unless value.nil? || Hoodoo::UUID.valid?( value )
    record.errors[ attribute ] << ( options[ :message ] || 'is invalid' )
  end

end