From e06e942e9b866a6c1e7fa78a644a22feb3c8c6eb Mon Sep 17 00:00:00 2001 From: avionix Date: Tue, 20 Sep 2022 10:59:15 -0400 Subject: [PATCH] Merge PR from https://github.com/dgm/unit_validation/pull/2 --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 82a07ec..cbf277b 100644 --- a/README.md +++ b/README.md @@ -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. +