lib/validators/phony_validator.rb in phony_rails-0.1.6 vs lib/validators/phony_validator.rb in phony_rails-0.1.7

- old
+ new

@@ -14,10 +14,15 @@ module ActiveModel module Validations module HelperMethods def validates_plausible_phone(*attr_names) - validates_with PhonyPlausibleValidator, _merge_attributes(attr_names) + # merged attributes are modified somewhere, so we are cloning them for each validator + merged_attributes = _merge_attributes(attr_names) + + validates_with PresenceValidator, merged_attributes.clone if merged_attributes[:presence] + validates_with FormatValidator, merged_attributes.clone if (merged_attributes[:with] or merged_attributes[:without]) + validates_with PhonyPlausibleValidator, merged_attributes.clone end end end end