instance method
pretty_print
Ruby on Rails 5.2.8.1
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 505
def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if defined?(@attributes) && @attributes
column_names = self.class.column_names.select { |name| has_attribute?(name) || new_record? }
pp.seplist(column_names, proc { pp.text "," }) do |column_name|
column_value = read_attribute(column_name)
pp.breakable " "
pp.group(1) do
pp.text column_name
pp.text ":"
pp.breakable
pp.pp column_value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end
Defined in activerecord/lib/active_record/core.rb line 505
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core