instance method
inspect
Ruby on Rails 7.0.10
Since v4.0.13Signature
inspect()
Returns the contents of the record as a nicely formatted string.
Source
# File activerecord/lib/active_record/core.rb, line 688
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.filter_map do |name|
if _has_attribute?(name)
"#{name}: #{attribute_for_inspect(name)}"
end
end.join(", ")
else
"not initialized"
end
"#<#{self.class} #{inspection}>"
end
Defined in activerecord/lib/active_record/core.rb line 688
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core