method
inspect
v6.1.7.7 -
Show latest stable
- Class:
ActiveRecord::Core
inspect()public
Returns the contents of the record as a nicely formatted string.
# File activerecord/lib/active_record/core.rb, line 716
def inspect
# We check defined?(@attributes) not to issue warnings if the object is
# allocated but not initialized.
inspection = if defined?(@attributes) && @attributes
self.class.attribute_names.collect do |name|
if _has_attribute?(name)
"#{name}: #{attribute_for_inspect(name)}"
end
end.compact.join(", ")
else
"not initialized"
end
"#<#{self.class} #{inspection}>"
end Related methods
- Instance methods
- <=>
- ==
- blank?
- clone
- connection_handler
- dup
- encode_with
- eql?
- freeze
- frozen?
- hash
- init_with
- init_with_attributes
- initialize_dup
- inspect
- present?
- pretty_print
- readonly!
- readonly?
- slice
- strict_loading!
- strict_loading?
- values_at
- Class methods
- allow_unsafe_raw_sql
- allow_unsafe_raw_sql=
- configurations
- configurations=
- connected_to_stack
- connection_class
- connection_class=
- connection_class?
- connection_classes
- connection_handler
- connection_handler=
- connection_handlers
- connection_handlers=
- current_preventing_writes
- current_role
- current_shard
- new
- strict_loading_violation!
- Private methods
-
custom_inspect_method_defined? -
init_internals -
initialize_internals_callback -
inspection_filter -
to_ary