Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No need to create a variables to use them once.

  • Loading branch information...
commit e2bad8a2e7e020901ddb74c3404a1c339b5a99f9 1 parent d29d793
@miloops miloops authored tenderlove committed
Showing with 2 additions and 5 deletions.
  1. +2 −5 activerecord/lib/active_record/validations/uniqueness.rb
View
7 activerecord/lib/active_record/validations/uniqueness.rb
@@ -14,17 +14,14 @@ def setup(klass)
def validate_each(record, attribute, value)
finder_class = find_finder_class_for(record)
- table = finder_class.unscoped
-
- table_name = record.class.quoted_table_name
if value && record.class.serialized_attributes.key?(attribute.to_s)
value = YAML.dump value
end
- sql, params = mount_sql_and_params(finder_class, table_name, attribute, value)
+ sql, params = mount_sql_and_params(finder_class, record.class.quoted_table_name, attribute, value)
- relation = table.where(sql, *params)
+ relation = finder_class.unscoped.where(sql, *params)
Array.wrap(options[:scope]).each do |scope_item|
scope_value = record.send(scope_item)
Please sign in to comment.
Something went wrong with that request. Please try again.