method
pretty_print
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::Core
pretty_print(pp)public
Takes a PP and prettily prints this record to it, allowing you to get a nice result from pp record when pp is required.
# File activerecord/lib/active_record/core.rb, line 769
def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if @attributes
attr_names = attributes_for_inspect.select { |name| _has_attribute?(name.to_s) }
pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
attr_name = attr_name.to_s
pp.breakable " "
pp.group(1) do
pp.text attr_name
pp.text ":"
pp.breakable
value = attribute_for_inspect(attr_name)
pp.text value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end Related methods
- Instance methods
- <=>
- ==
- blank?
- clone
- connection_handler
- dup
- encode_with
- eql?
- freeze
- frozen?
- full_inspect
- hash
- init_attributes
- 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
-
all_attributes_for_inspect -
attributes_for_inspect -
custom_inspect_method_defined? -
init_internals -
initialize_internals_callback -
inspect_with_attributes -
inspection_filter -
to_ary