mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use private attr_reader
Since #32028, Rails 6 requires Ruby 2.3+. No longer needed workaround for Ruby 2.2 "private attribute?" warning.
This commit is contained in:
parent
cf629f6d29
commit
6d63b5e49a
12 changed files with 13 additions and 26 deletions
|
@ -58,7 +58,7 @@ module ActiveRecord
|
||||||
tables.first
|
tables.first
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
attr_reader :alias_tracker
|
attr_reader :alias_tracker
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -169,7 +169,7 @@ module ActiveRecord
|
||||||
owners.flat_map { |owner| owner.association(reflection.name).target }
|
owners.flat_map { |owner| owner.association(reflection.name).target }
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
attr_reader :owners, :reflection
|
attr_reader :owners, :reflection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,9 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
attr_reader :owners, :reflection, :preload_scope, :model, :klass
|
attr_reader :owners, :reflection, :preload_scope, :model, :klass
|
||||||
|
|
||||||
private
|
|
||||||
# The name of the key on the associated records
|
# The name of the key on the associated records
|
||||||
def association_key_name
|
def association_key_name
|
||||||
reflection.join_primary_key(klass)
|
reflection.join_primary_key(klass)
|
||||||
|
|
|
@ -432,15 +432,12 @@ module ActiveRecord
|
||||||
@attributes.accessed
|
@attributes.accessed
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
def attribute_method?(attr_name)
|
||||||
def attribute_method?(attr_name) # :nodoc:
|
|
||||||
# We check defined? because Syck calls respond_to? before actually calling initialize.
|
# We check defined? because Syck calls respond_to? before actually calling initialize.
|
||||||
defined?(@attributes) && @attributes.key?(attr_name)
|
defined?(@attributes) && @attributes.key?(attr_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def arel_attributes_with_values_for_create(attribute_names)
|
def arel_attributes_with_values_for_create(attribute_names)
|
||||||
arel_attributes_with_values(attributes_for_create(attribute_names))
|
arel_attributes_with_values(attributes_for_create(attribute_names))
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,10 +20,9 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
attr_reader :max_identifier_length
|
attr_reader :max_identifier_length
|
||||||
|
|
||||||
private
|
|
||||||
def sequence_name_from_parts(table_name, column_name, suffix)
|
def sequence_name_from_parts(table_name, column_name, suffix)
|
||||||
over_length = [table_name, column_name, suffix].map(&:length).sum + 2 - max_identifier_length
|
over_length = [table_name, column_name, suffix].map(&:length).sum + 2 - max_identifier_length
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,6 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_reader :table
|
|
||||||
|
|
||||||
def expand_from_hash(attributes)
|
def expand_from_hash(attributes)
|
||||||
return ["1=0"] if attributes.empty?
|
return ["1=0"] if attributes.empty?
|
||||||
|
|
||||||
|
@ -109,6 +106,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
attr_reader :table
|
||||||
|
|
||||||
def associated_predicate_builder(association_name)
|
def associated_predicate_builder(association_name)
|
||||||
self.class.new(table.associated_table(association_name))
|
self.class.new(table.associated_table(association_name))
|
||||||
|
|
|
@ -34,8 +34,7 @@ module ActiveRecord
|
||||||
array_predicates.inject(&:or)
|
array_predicates.inject(&:or)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :predicate_builder
|
attr_reader :predicate_builder
|
||||||
|
|
||||||
module NullPredicate # :nodoc:
|
module NullPredicate # :nodoc:
|
||||||
|
|
|
@ -11,8 +11,7 @@ module ActiveRecord
|
||||||
predicate_builder.build(attribute, value.id)
|
predicate_builder.build(attribute, value.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :predicate_builder
|
attr_reader :predicate_builder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,8 +12,7 @@ module ActiveRecord
|
||||||
attribute.eq(bind)
|
attribute.eq(bind)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :predicate_builder
|
attr_reader :predicate_builder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,8 +33,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :predicate_builder
|
attr_reader :predicate_builder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,8 +26,7 @@ module ActiveRecord
|
||||||
WhereClause.new(parts)
|
WhereClause.new(parts)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :klass, :predicate_builder
|
attr_reader :klass, :predicate_builder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,8 +114,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
attr_reader :query_builder, :bind_map, :klass
|
attr_reader :query_builder, :bind_map, :klass
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue