1
0
Fork 0
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:
Ryuta Kamizono 2018-02-23 11:10:51 +09:00
parent cf629f6d29
commit 6d63b5e49a
12 changed files with 13 additions and 26 deletions

View file

@ -58,7 +58,7 @@ module ActiveRecord
tables.first
end
protected
private
attr_reader :alias_tracker
end
end

View file

@ -169,7 +169,7 @@ module ActiveRecord
owners.flat_map { |owner| owner.association(reflection.name).target }
end
protected
private
attr_reader :owners, :reflection
end

View file

@ -27,10 +27,9 @@ module ActiveRecord
end
end
protected
private
attr_reader :owners, :reflection, :preload_scope, :model, :klass
private
# The name of the key on the associated records
def association_key_name
reflection.join_primary_key(klass)

View file

@ -432,15 +432,12 @@ module ActiveRecord
@attributes.accessed
end
protected
def attribute_method?(attr_name) # :nodoc:
private
def attribute_method?(attr_name)
# We check defined? because Syck calls respond_to? before actually calling initialize.
defined?(@attributes) && @attributes.key?(attr_name)
end
private
def arel_attributes_with_values_for_create(attribute_names)
arel_attributes_with_values(attributes_for_create(attribute_names))
end

View file

@ -20,10 +20,9 @@ module ActiveRecord
end
end
protected
private
attr_reader :max_identifier_length
private
def sequence_name_from_parts(table_name, column_name, suffix)
over_length = [table_name, column_name, suffix].map(&:length).sum + 2 - max_identifier_length

View file

@ -57,9 +57,6 @@ module ActiveRecord
end
protected
attr_reader :table
def expand_from_hash(attributes)
return ["1=0"] if attributes.empty?
@ -109,6 +106,7 @@ module ActiveRecord
end
private
attr_reader :table
def associated_predicate_builder(association_name)
self.class.new(table.associated_table(association_name))

View file

@ -34,8 +34,7 @@ module ActiveRecord
array_predicates.inject(&:or)
end
protected
private
attr_reader :predicate_builder
module NullPredicate # :nodoc:

View file

@ -11,8 +11,7 @@ module ActiveRecord
predicate_builder.build(attribute, value.id)
end
protected
private
attr_reader :predicate_builder
end
end

View file

@ -12,8 +12,7 @@ module ActiveRecord
attribute.eq(bind)
end
protected
private
attr_reader :predicate_builder
end
end

View file

@ -33,8 +33,7 @@ module ActiveRecord
end
end
protected
private
attr_reader :predicate_builder
end
end

View file

@ -26,8 +26,7 @@ module ActiveRecord
WhereClause.new(parts)
end
protected
private
attr_reader :klass, :predicate_builder
end
end

View file

@ -114,8 +114,7 @@ module ActiveRecord
end
end
protected
private
attr_reader :query_builder, :bind_map, :klass
end
end