diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-31 16:42:25 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-31 16:42:25 +0000 |
commit | 256d3871597079a274aa9685b66e34307ff479b1 (patch) | |
tree | 689fd03013204152139d63a4a86b2c28e1e2d5dd /activerecord/lib/active_record | |
parent | 43f5ab93e016ced1592046229b82c28b2dae4556 (diff) | |
download | rails-256d3871597079a274aa9685b66e34307ff479b1.tar.gz rails-256d3871597079a274aa9685b66e34307ff479b1.tar.bz2 rails-256d3871597079a274aa9685b66e34307ff479b1.zip |
Fixed quoting in validates_format_of that would allow some rules to pass regardless of input #390 [Dmitry V. Sabanin]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@288 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 1d0dd68df8..a451e4299a 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -240,7 +240,7 @@ module ActiveRecord raise(ArgumentError, "A regular expression must be supplied as the :with option of the configuration hash") unless configuration[:with].is_a?(Regexp) for attr_name in attr_names - class_eval(%(#{validation_method(configuration[:on])} %{errors.add("#{attr_name}", "#{configuration[:message]}") unless #{attr_name} and #{attr_name}.to_s.match(/#{configuration[:with]}/)})) + class_eval(%(#{validation_method(configuration[:on])} %{errors.add("#{attr_name}", "#{configuration[:message]}") unless #{attr_name} and #{attr_name}.to_s.match(/#{Regexp.quote(configuration[:with].source)}/)})) end end |