Repository is archived
No commit activity in last 3 years
No release in over 3 years
ActiveModel validations for domains with fully localization support.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 3.0.0
 Project Readme

Domain Validator Travis Code Climate

This is a ActiveModel validator for domains.

Installation

gem install domain-validator

Usage

In your models, the gem provides new :domain validator

class Model < ActiveRecord::Base
  validates :domain_name, domain: true
end

Domain Validator

validates :domain_name, domain: true

validates :domain_name, domain: { message: 'custom message' }

Localization Tricks

To customize error message, you can use { message: "your custom message" } or simple use Rails localization en.yml file, for instance:

en:
  errors:
    messages:
      domain:
        long: "your custom length error message"
  activemodel:
    errors:
      messages:
        domain:
          invalid: "custom error message only for activemodel"
       models:
         your_model:
           domain:
             invalid: "custom error message for YourDomain model"

Copyright

Copyright 2015 Shuttlerock Ltd. See LICENSE for details.