fix for validation nil value with :format option plugin parser disabled (issue 34)

This commit is contained in:
Adam Meehan
2011-01-29 16:04:35 +11:00
parent 983e80f239
commit 3793ef2ed4
4 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
module ConfigHelper
# Justin French tip
def with_config(preference_name, temporary_value)
old_value = ValidatesTimeliness.send(preference_name)
ValidatesTimeliness.send(:"#{preference_name}=", temporary_value)
yield
ensure
ValidatesTimeliness.send(:"#{preference_name}=", old_value)
end
end