aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-04-07 18:52:21 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2014-04-07 18:52:21 -0700
commita5664fe27b1797983537c0764003e618bd3d2801 (patch)
treedd10cf4cf3f4b627b03dfe07e2c0eda197eb466c /activerecord/lib/active_record/validations
parent3f5eb59f7a48aa5c08efb8db6cb41cd395c990af (diff)
downloadrails-a5664fe27b1797983537c0764003e618bd3d2801.tar.gz
rails-a5664fe27b1797983537c0764003e618bd3d2801.tar.bz2
rails-a5664fe27b1797983537c0764003e618bd3d2801.zip
Follow up to bbe7fe41 to fix enum leakage across classes.
The original attempt didn't really fix the problem and wasn't testing the problematic area. This commit corrected those issues in the original commit. Also removed the private `enum_mapping_for` method. As `defined_enums` is now a method, this method doesn't provide much value anymore.
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index 71c71cb4b1..ee080451a9 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -93,7 +93,7 @@ module ActiveRecord
end
def map_enum_attribute(klass, attribute, value)
- mapping = klass.enum_mapping_for(attribute.to_s)
+ mapping = klass.defined_enums[attribute.to_s]
value = mapping[value] if value && mapping
value
end