19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/client_side_validations/active_model.rb', line 19
def client_side_validation_hash
_validators.except(nil).inject({}) do |attr_hash, attr|
validator_hash = attr[1].inject({}) do |kind_hash, validator|
client_side_hash = validator.client_side_hash(self, attr[0])
if (can_use_for_client_side_validation?(client_side_hash, validator))
kind_hash.merge!(validator.kind => client_side_hash.except(:on))
else
kind_hash.merge!({})
end
end
attr_hash.merge!(attr[0] => validator_hash)
end.delete_if { |key, value| value.blank? }
end
|