No commit activity in last 3 years
No release in over 3 years
Rails validators for: date, date_time, ip address, mac address
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 10.0
~> 3.1

Runtime

< 6.0, >= 4.0.1
 Project Readme

UniversalValidatorsRails Build Status

Rails validators for:

  • date
  • date_time
  • ip address
  • mac address

Installation

Add this line to your application's Gemfile:

gem 'universal_validators_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install universal_validators_rails

Usage

class User
  include ActiveModel::Validations

  attr_accessor :date, :date_time, :ip_address, :mac_address

  validates :date, date: true
  validates :date_time, date_time: true
  validates :ip_address, ip_address: { with_mask: true }
  validates :mac_address, mac_address: true
end

user = User.new
user.date = '2015-02-25'
user.date_time = '2015-02-25 12:33'
user.ip_address = '127.0.0.1/32'
user.mac_address = '00:0A:CD:00:CC:FE'
user.valid?
=> true

Contributing

  1. Fork it ( https://github.com/dbackowski/universal_validators_rails/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request