method
inspect
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::Core
inspect()public
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!">"