mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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
This commit is contained in:
@@ -75,11 +75,9 @@ module ActiveRecord
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user