Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

dgm/unit_validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitValidator

UnitValidator provides a rails model validator using ruby-units to detect valid units of measurement

Installation

Just add this to your Gemfile:

gem 'unit_validation'

and run

bundle install

Usage

Put something like this in your models:

validates :height, :unit => true
validates :count, :unit => {:allowed_types => :unitless}
validates :width, :unit => {:allowed_types => [:mass, :length]}

About

A Rails Validation class for ruby-units

Resources

License

Stars

Watchers

Forks

Packages

No packages published