aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-11 04:58:40 -0800
committerXavier Noria <fxn@hashref.com>2012-02-11 04:58:40 -0800
commit5f548eb28e526e14449f6595abee214ff8bf8dd2 (patch)
treeb3f022e7ec4a37d932a15af6c75f8ffeb0d14754 /activerecord/lib/active_record/validations
parent69147ee0720b667aa2b7eb24a64639162ac844a3 (diff)
downloadrails-5f548eb28e526e14449f6595abee214ff8bf8dd2.tar.gz
rails-5f548eb28e526e14449f6595abee214ff8bf8dd2.tar.bz2
rails-5f548eb28e526e14449f6595abee214ff8bf8dd2.zip
say unshift when you mean unshift (modulus prepend)
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index 7fd5d76ba5..9556878f63 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/array/prepend_and_append'
+
module ActiveRecord
module Validations
class UniquenessValidator < ActiveModel::EachValidator
@@ -49,7 +51,7 @@ module ActiveRecord
class_hierarchy = [record.class]
while class_hierarchy.first != @klass
- class_hierarchy.insert(0, class_hierarchy.first.superclass)
+ class_hierarchy.prepend(class_hierarchy.first.superclass)
end
class_hierarchy.detect { |klass| !klass.abstract_class? }