class PostcodeFormatValidator

Public Instance Methods

validate_each(object, attribute, value) click to toggle source
# File lib/postoffice.rb, line 181
def validate_each(object, attribute, value)
        
        result = PostOffice.validate_postcode(value, options[:country_code])

        if !result
                object.errors[attribute] << (options[:message] || "entered is not a valid postcode for #{PostOffice.country_name(options[:country_code])}.") 
        end
end