method
pretty_print
rails latest stable - Class:
ActiveRecord::Core::ClassMethods
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v7.0.0) is shown here.
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 705
def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if defined?(@attributes) && @attributes
attr_names = self.class.attribute_names.select { |name| _has_attribute?(name) }
pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
pp.breakable " "
pp.group(1) do
pp.text attr_name
pp.text ":"
pp.breakable
value = _read_attribute(attr_name)
value = inspection_filter.filter_param(attr_name, value) unless value.nil?
pp.pp value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end Related methods
- Instance methods
- <=>
- ==
- ===
- arel_table
- blank?
- cached_find_by_statement
- clone
- connection_handler
- custom_inspect_method_defined?
- dup
- encode_with
- eql?
- filter_attributes
- filter_attributes=
- find
- find_by
- find_by!
- freeze
- frozen?
- generated_association_methods
- hash
- inherited
- init_internals
- init_with
- init_with_attributes
- initialize_dup
- initialize_find_by_cache
- initialize_generated_modules
- initialize_internals_callback
- inspect
- inspection_filter
- predicate_builder
- present?
- pretty_print
- readonly!
- readonly?
- relation
- slice
- strict_loading!
- strict_loading?
- strict_loading_n_plus_one_only?
- table_metadata
- to_ary
- type_caster
- values_at
- Class methods
- new