instance method
inspect
Ruby on Rails 4.2.9
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 444
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.column_names.collect { |name|
if has_attribute?(name)
"#{name}: #{attribute_for_inspect(name)}"
end
}.compact.join(", ")
else
"not initialized"
end
"#<#{self.class} #{inspection}>"
end
Defined in activerecord/lib/active_record/core.rb line 444
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core