aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-11-06 13:32:02 +0900
committerGitHub <noreply@github.com>2018-11-06 13:32:02 +0900
commit212c28ac86fec0f2baf57fbc21ceb8696092fe47 (patch)
treea1775a4f7690423034d60e4168501efc45d268f4 /activerecord/lib
parenta8c06c2d7dfa49a9fede1eec65c1058fe0fac82b (diff)
parent65cd0fda2572ac9c78d8582496a9009d0c48df08 (diff)
downloadrails-212c28ac86fec0f2baf57fbc21ceb8696092fe47.tar.gz
rails-212c28ac86fec0f2baf57fbc21ceb8696092fe47.tar.bz2
rails-212c28ac86fec0f2baf57fbc21ceb8696092fe47.zip
Merge pull request #34384 from eugeneius/inspect_with_non_primary_key_id_attribute
Fix inspect with non-primary key id attribute
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb2
-rw-r--r--activerecord/lib/active_record/core.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 1e92ee3b96..fd8c1da842 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -328,7 +328,7 @@ module ActiveRecord
# person.attribute_for_inspect(:tag_ids)
# # => "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]"
def attribute_for_inspect(attr_name)
- value = read_attribute(attr_name)
+ value = _read_attribute(attr_name)
format_for_inspect(value)
end
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index da3e2549a2..50f3087c51 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -498,7 +498,7 @@ module ActiveRecord
inspection = if defined?(@attributes) && @attributes
self.class.attribute_names.collect do |name|
if has_attribute?(name)
- attr = read_attribute(name)
+ attr = _read_attribute(name)
value = if attr.nil?
attr.inspect
else
@@ -528,7 +528,7 @@ module ActiveRecord
pp.text attr_name
pp.text ":"
pp.breakable
- value = read_attribute(attr_name)
+ value = _read_attribute(attr_name)
value = inspection_filter.filter_param(attr_name, value) unless value.nil?
pp.pp value
end