diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-01 05:27:28 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-30 18:17:05 +0900 |
commit | 5734dcd8114cf2958cf4dd40f9402562d7a431fa (patch) | |
tree | ee869391471c2cc6c01ad7f75547d189d10002b5 /activerecord/lib/active_record/relation/predicate_builder | |
parent | 5d9d6a4fbf72029266bfa643929a9a80f9286fbe (diff) | |
download | rails-5734dcd8114cf2958cf4dd40f9402562d7a431fa.tar.gz rails-5734dcd8114cf2958cf4dd40f9402562d7a431fa.tar.bz2 rails-5734dcd8114cf2958cf4dd40f9402562d7a431fa.zip |
Don't expose methods and attrs for internal usage
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb index 2fe0f81cab..3e19646ae5 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb @@ -1,8 +1,6 @@ module ActiveRecord class PredicateBuilder class AssociationQueryValue # :nodoc: - attr_reader :associated_table, :value - def initialize(associated_table, value) @associated_table = associated_table @value = value @@ -12,6 +10,11 @@ module ActiveRecord [associated_table.association_foreign_key.to_s => ids] end + # TODO Change this to private once we've dropped Ruby 2.2 support. + # Workaround for Ruby 2.2 "private attribute?" warning. + protected + attr_reader :associated_table, :value + private def ids case value diff --git a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb index 9bb2f8c8dc..7029ae5f47 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb @@ -1,8 +1,6 @@ module ActiveRecord class PredicateBuilder class PolymorphicArrayValue # :nodoc: - attr_reader :associated_table, :values - def initialize(associated_table, values) @associated_table = associated_table @values = values @@ -17,6 +15,11 @@ module ActiveRecord end end + # TODO Change this to private once we've dropped Ruby 2.2 support. + # Workaround for Ruby 2.2 "private attribute?" warning. + protected + attr_reader :associated_table, :values + private def type_to_ids_mapping default_hash = Hash.new { |hsh, key| hsh[key] = [] } |