Simple IP validator for Rails 3+
|Version||1.0.1 (Mar 19, 2012)|
|License||Released under the MIT license.|
This gem adds a very simple IP address format validator to be used with ActiveRecord models in Rails 3.0. It supports localized error messages.
Add the gem to your project's
This gem is an
EachValidator, and thus is used with the
class User < ActiveRecord::Base validates :last_login_ip, ip_address: true end
The localization key is
invalid_ip, and can be specified in the localized
YAML file like so:
en: activerecord: errors: messages: invalid_ip: IP address is invalid.