A few basic extra validations for Ruby on Rails.
I18N
The gem includes English and Chinese error messages. If you want to translate it
to another language then copy [config/locales/en.yml
][tr] to your project.
Please send us your translations so we can add them!
Available validations
email
Validate if a string looks like an email address. This should work with unicode
addresses ([RFC 6531][rfc6531], [IDN][idn]).
Accepts martin@lico.nl
, but rejects martinlico.nl
or martin@lico
:
validates :email_column, email: true
validates_email_of :email_column
phone
Check if this is a valid phone number. This should work with most, if not all.
validates :phone_number_column, phone: true
validates_phone_of :phone_number_column
qq
Check if this is a valid qq number.
validates :qq_column, qq: true
validates_qq_of :qq_column
url_name
Check if this is a valid url_name.
validates :url_name_column, url_name: true
validates_url_name_of :url_name_column