how to create a custom validator

these are good

http://www.railsjitsu.com/ruby-on-rails/writing-your-own-custom-validators/
http://paulsturgess.co.uk/articles/show/33-how-to-write-custom-validation-in-ruby-on-rails