No release in over 3 years
Low commit activity in last 3 years
A simple, localizable EachValidator for IPv4 and IPv6 address fields in ActiveRecord 3.0.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

ip_address_validator

Simple IP validator for Rails 3+

Author Tim Morgan
Version 1.0.1 (Mar 19, 2012)
License Released under the MIT license.

About

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.

Installation

Add the gem to your project's Gemfile:

gem "ip_address_validator"

Usage

This gem is an EachValidator, and thus is used with the validates method:

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.