Method: ActiveRecord::Core#pretty_print
- Defined in:
- activerecord/lib/active_record/core.rb
#pretty_print(pp) ⇒ Object
Takes a PP and prettily prints this record to it, allowing you to get a nice result from pp record when pp is required.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'activerecord/lib/active_record/core.rb', line 798 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 |