instance method
inspect
Ruby on Rails 7.2.3
Since v4.0.13Signature
inspect()
Returns the attributes of the record as a nicely formatted string.
Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!", published_at: "2023-10-23 14:28:11 +0000">"
The attributes can be limited by setting .attributes_for_inspect.
Post.attributes_for_inspect = [:id, :title] Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!">"
Source
# File activerecord/lib/active_record/core.rb, line 769
def inspect
inspect_with_attributes(attributes_for_inspect)
end
Defined in activerecord/lib/active_record/core.rb line 769
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core