Permalink
Browse files

No need to create a variables to use them once.

  • Loading branch information...
miloops authored and tenderlove committed Nov 20, 2010
1 parent d29d793 commit e2bad8a2e7e020901ddb74c3404a1c339b5a99f9
Showing with 2 additions and 5 deletions.
  1. +2 −5 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)

0 comments on commit e2bad8a

Please sign in to comment.