Class: RealIdValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- RealIdValidator
- Defined in:
- lib/custom_validators/real_id.rb
Overview
Real ID format validator for Blizzard’s Battle.net 2.0
Usage
validates :foo, :real_id => true
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
:nodoc:#
9 10 11 12 |
# File 'lib/custom_validators/real_id.rb', line 9 def validate_each(record, attribute, value) #:nodoc:# record.errors[attribute] << ([:message] || "is not a Real ID") unless value =~ /^([a-zA-Z]{3,})\.([a-z]{3,})$/i end |