Validates As UK Postcode (version 2.0)
This Ruby on Rails plugin implements an ActiveRecord validation macro to allow validating of UK Postcodes. It is based on the following regular expression.
gem install validates_as_uk_postcode
# environment.rb config.gem "validates_as_uk_postcode"
# Gemfile gem "validates_as_uk_postcode"
class MyClass < ActiveRecord::Base validates_as_uk_postcode :postcode end
class MyClass < ActiveRecord::Base validates :postcode, :uk_postcode => true end
This code is released under a Creative Commons Attribution-Share Alike 3.0 Unported License. The license can be seen here:
The original version of the code (see History) was released under the Creative Commons Attribution-Share Alike 2.5 License, which can be seen at: