instance method
pretty_print
Ruby on Rails 8.0.4
Since v4.2.9Signature
pretty_print(pp)
Takes a PP and prettily prints this record to it, allowing you to get a nice result from pp record when pp is required.
Parameters
-
ppreq
Source
# File activerecord/lib/active_record/core.rb, line 800
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
Defined in activerecord/lib/active_record/core.rb line 800
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core