lib/phony_rails.rb in phony_rails-0.6.1 vs lib/phony_rails.rb in phony_rails-0.6.2

- old
+ new

@@ -65,11 +65,11 @@ def phony_normalize(*attributes) options = attributes.last.is_a?(Hash) ? attributes.pop : {} options.assert_valid_keys :country_code, :default_country_code, :as if options[:as].present? raise ArgumentError, ':as option can not be used on phony_normalize with multiple attribute names! (PhonyRails)' if attributes.size > 1 - raise ArgumentError, "'#{options[:as]}' is not an attribute on #{self.name}. You might want to use 'phony_normalized_method :#{attributes.first}' (PhonyRails)" if not self.attribute_method?(options[:as]) end + # Add before validation that saves a normalized version of the phone number self.before_validation do set_phony_normalized_numbers(attributes, options) end end