Skip to content

Commit

Permalink
Merge PR from dgm/unit_validation#2
Browse files Browse the repository at this point in the history
  • Loading branch information
avionix-g committed Sep 20, 2022
1 parent 6fe8e9b commit e06e942
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ Put something like this in your models:
validates :count, :unit => {:allowed_types => :unitless}
validates :width, :unit => {:allowed_types => [:mass, :length]}

### Error messages

The error message upon failure can be overridden by passing the option `message` to the unit validation:

validates :quantity, :unit => {:message => 'please be so kind as to enter a physical quantity'}

If not supplied, a localised message is shown.
Translations are kept in [localeapp#6170](http://www.localeapp.com/projects/6170) - please feel free to
add a new translation or correct something.

0 comments on commit e06e942

Please sign in to comment.