lib/validators/phony_validator.rb in phony_rails-0.14.0 vs lib/validators/phony_validator.rb in phony_rails-0.14.1
- old
+ new
@@ -13,11 +13,11 @@
end
private
def error_message
- options_value(:message) || :improbable_phone
+ options[:message] || :improbable_phone
end
def country_number
options_value(:country_number) || record_country_number || country_number_from_country_code
end
@@ -41,14 +41,14 @@
def normalized_country_code
options_value(:normalized_country_code)
end
def options_value(option)
- if options[option].is_a?(Symbol)
- @record.send(options[option])
- else
- options[option]
- end
+ option_value = options[option]
+
+ return option_value unless option_value.is_a?(Symbol)
+
+ @record.send(option_value)
end
end
module ActiveModel
module Validations