ActivemodelErrorsType
Allows to get errors type from an activemodel class, as a symbol, prior to the translation
Installation
Add this line to your application's Gemfile:
gem 'activemodel_errors_type'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activemodel_errors_type
Usage
On any active model class, after calling save
or valid?
or anything that triggers the validation :
model.errors.with_types
You will get a hash, for example :
{
:key1 => [:inclusion],
:key2 => [:blank, :numericality]
}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request