Skip to content
Browse files

Changed the Proc for a string to avoid repetition problems

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@96 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a65f791 commit d33f814db500538cee14b3db83afaef5f671a692 @dhh dhh committed Dec 9, 2004
Showing with 3 additions and 5 deletions.
  1. +3 −5 activerecord/lib/active_record/validations.rb
View
8 activerecord/lib/active_record/validations.rb
@@ -75,11 +75,9 @@ module ClassMethods
def validate_confirmation(*attr_names)
for attr_name in attr_names
attr_accessor "#{attr_name}_confirmation"
- class_eval <<-EOC
- validate_on_create(Proc.new { |record|
- record.errors.add("#{attr_name}", "doesn't match confirmation") unless record.#{attr_name} == record.#{attr_name}_confirmation
- })
-EOC
+ class_eval <<-EOM
+ validate_on_create %{errors.add('#{attr_name}', "doesn't match confirmation") unless #{attr_name} == #{attr_name}_confirmation}
+EOM
end
end
end

0 comments on commit d33f814

Please sign in to comment.
Something went wrong with that request. Please try again.