11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/client_side_validations/active_model/numericality.rb', line 11
def client_side_hash(model, attribute)
except_options = ::ActiveModel::Errors::CALLBACKS_OPTIONS - [:on] + [:message]
= options.except(*except_options).reject { |key, value| key == :only_integer && !value }
keys = [:numericality] | (.keys - [:message, :on])
filtered_options = options.except(*self.class::RESERVED_OPTIONS)
messages = keys.inject({}) do |hash, key|
count = [key]
hash.merge!(key => model.errors.generate_message(attribute, OPTION_MAP[key], filtered_options.merge(:count => count)))
end
{ :messages => messages }.merge()
end
|