diff options
author | Akira Matsuda <ronnie@dio.jp> | 2016-12-23 15:51:11 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2016-12-24 23:39:36 +0900 |
commit | 5b14129d8d4ad302b4e11df6bd5c7891b75f393c (patch) | |
tree | cfcd0a51846f540f40cc314e29a7070b415a9219 /activerecord/lib/active_record/validations/uniqueness.rb | |
parent | 6c5bbb4b7d3bdd1b43e512fb6ae764c373c7827b (diff) | |
download | rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.gz rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.bz2 rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.zip |
Privatize unneededly protected methods in Active Record
Diffstat (limited to 'activerecord/lib/active_record/validations/uniqueness.rb')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 512fdadacc..453d7079ac 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -33,13 +33,13 @@ module ActiveRecord end end - protected + private # The check for an existing value should be run from a class that # isn't abstract. This means working down from the current class # (self), to the first non-abstract class. Since classes don't know # their subclasses, we have to build the hierarchy between self and # the record's class. - def find_finder_class_for(record) #:nodoc: + def find_finder_class_for(record) class_hierarchy = [record.class] while class_hierarchy.first != @klass @@ -49,7 +49,7 @@ module ActiveRecord class_hierarchy.detect { |klass| !klass.abstract_class? } end - def build_relation(klass, attribute, value) # :nodoc: + def build_relation(klass, attribute, value) if reflection = klass._reflect_on_association(attribute) attribute = reflection.foreign_key value = value.attributes[reflection.klass.primary_key] unless value.nil? @@ -83,7 +83,7 @@ module ActiveRecord end end - def scope_relation(record, relation) + def scope_relation(record, relation) # :doc: Array(options[:scope]).each do |scope_item| scope_value = if record.class._reflect_on_association(scope_item) record.association(scope_item).reader @@ -96,7 +96,7 @@ module ActiveRecord relation end - def map_enum_attribute(klass, attribute, value) + def map_enum_attribute(klass, attribute, value) # :doc: mapping = klass.defined_enums[attribute.to_s] value = mapping[value] if value && mapping value |