10 11 12
# File 'lib/rails3.rb', line 10 def validate_each(object, attribute, value) object.errors.add(attribute, "is an invalid UK postcode") unless value =~ Postcodes::UK end