Class: Rails::Angulate::Mappers::NumericalityValidatorMapper
- Inherits:
-
BaseMapper
- Object
- BaseMapper
- Rails::Angulate::Mappers::NumericalityValidatorMapper
- Defined in:
- lib/rails/angulate/mappers/numericality_validator_mapper.rb
Constant Summary collapse
- CHECKS =
ActiveModel::Validations::NumericalityValidator::CHECKS
Instance Attribute Summary
Attributes inherited from BaseMapper
#attribute, #model, #validator
Instance Method Summary collapse
Methods inherited from BaseMapper
#full_message, inherited, #initialize
Constructor Details
This class inherits a constructor from Rails::Angulate::Mappers::BaseMapper
Instance Method Details
#error_messages ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails/angulate/mappers/numericality_validator_mapper.rb', line 14 def = {} = [:message] || with_i18n do |locale| .each do |option, option_value| [option] = ( locale.t :"messages.#{option}", translate_params.merge(count: option_value) ) if allow_only_integer? [:only_integer] = ( locale.t :"messages.not_an_integer", translate_params.merge(count: option_value) ) end end end end |
#ng_attributes ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rails/angulate/mappers/numericality_validator_mapper.rb', line 7 def ng_attributes {}.tap do |attrs| attrs["ang-validator"] = "numericality" attrs["ang-valid-if"] = numericality_conditions.to_json end end |