class method
self.attributes_for_inspect
Ruby on Rails 7.2.3
Since v7.2.3Specifies the attributes that will be included in the output of the #inspect method:
Post.attributes_for_inspect = [:id, :title] Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!">"
When set to :all inspect will list all the record’s attributes:
Post.attributes_for_inspect = :all Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!", published_at: "2023-10-23 14:28:11 +0000">"
Source
# File activerecord/lib/active_record/core.rb, line 118
class_attribute :attributes_for_inspect, instance_accessor: false, default: :all
Defined in activerecord/lib/active_record/core.rb line 118
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core