validates_as_uk_postcode
- Filed under ActiveRecord and Miscellaneous
- Developed by Stephen Rushe (srushe)
ValidatesAsUkPostcode 0.1
This Ruby on Rails plugin implements an ActiveRecord validation helper called validates_as_uk_postcode. The helper acts as if validates_format_of was used with a regular expression that defines an valid UK postcode: http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm Installation ------------ ruby script/plugin install http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode Full documentation on script/plugin can be obtained by invoking the plugin script with no arguments: ruby script/plugin You may need to restart your webserver in order to load the plugin files. Usage ----- In your model file do something like: class MyClass < ActiveRecord::Base validates_as_uk_postcode :postcode end License ------- I took the code for validates_as_email as my inspiration for this so I feel that I should release this code under the same license which is a Creative Commons Attribution-ShareALike 2.5 License. The license can be seen here: http://creativecommons.org/licenses/by-sa/2.5/ Credits ------- Written by Steve Rushe(www.deeden.co.uk) for www.designbyfront.com
Last updated: September 09, 2007 00:50


