diff options
author | Matthew Draper <matthew@trebex.net> | 2017-05-31 04:26:52 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-31 04:26:52 +0930 |
commit | f495e0ff0bd00a2dd68cded0ae5d0dcf38e4ddfc (patch) | |
tree | f93671628e35df5745efb2db4c018007d493795b /activerecord/lib/active_record/relation | |
parent | ac3c04513ed3e9c47c14f1d33db02b1e3b4031b8 (diff) | |
parent | 5734dcd8114cf2958cf4dd40f9402562d7a431fa (diff) | |
download | rails-f495e0ff0bd00a2dd68cded0ae5d0dcf38e4ddfc.tar.gz rails-f495e0ff0bd00a2dd68cded0ae5d0dcf38e4ddfc.tar.bz2 rails-f495e0ff0bd00a2dd68cded0ae5d0dcf38e4ddfc.zip |
Merge pull request #29261 from kamipo/dont_expose_methods_and_attrs_for_internal_usage
Don't expose methods and attrs for internal usage
Diffstat (limited to 'activerecord/lib/active_record/relation')
-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] = [] } |