APIdock / Ruby on Rails
/
Browse About
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!">"
# File activerecord/lib/active_record/core.rb, line 769
    def inspect
      inspect_with_attributes(attributes_for_inspect)
    end

Related methods

  • Instance methods
  • <=>
  • ==
  • blank?
  • clone
  • connection_handler
  • dup
  • encode_with
  • eql?
  • freeze
  • frozen?
  • full_inspect
  • hash
  • init_with
  • init_with_attributes
  • initialize_dup
  • inspect
  • present?
  • pretty_print
  • readonly!
  • readonly?
  • slice
  • strict_loading!
  • strict_loading?
  • strict_loading_all?
  • strict_loading_n_plus_one_only?
  • values_at
  • Class methods
  • application_record_class?
  • asynchronous_queries_session
  • asynchronous_queries_tracker
  • configurations
  • configurations=
  • connected_to_stack
  • connection_class
  • connection_class=
  • connection_class?
  • connection_class_for_self
  • connection_handler
  • connection_handler=
  • current_preventing_writes
  • current_role
  • current_shard
  • destroy_association_async_job
  • new
  • strict_loading_violation!
  • Private methods
  • privateall_attributes_for_inspect
  • privateattributes_for_inspect
  • privatecustom_inspect_method_defined?
  • privateinit_internals
  • privateinitialize_internals_callback
  • privateinspect_with_attributes
  • privateinspection_filter
  • privateto_ary
APIdock API Documentation Browser

Swarmia gives you actionable DORA metrics for your engineering team.

© 2026 APIdock