1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Allow for validates_format_of :without

Prevent erroning with `undefined method `source' for nil:NilClass` when format validation is a "without" one
This commit is contained in:
Gleb Mazovetskiy 2013-02-26 18:43:21 +01:00 committed by Vasiliy Ermolovich
parent 6cd76c7258
commit 05527de82e

View file

@ -13,8 +13,8 @@ module SimpleForm
pattern = options[:pattern]
if pattern.is_a?(String)
pattern
elsif pattern_validator = find_pattern_validator
evaluate_format_validator_option(pattern_validator.options[:with]).source
elsif (pattern_validator = find_pattern_validator) && (with = pattern_validator.options[:with])
evaluate_format_validator_option(with).source
end
end