Method: ActiveRecord::Core::ClassMethods#inspect

Defined in:
activerecord/lib/active_record/core.rb

#inspectObject

Returns a string like ‘Post(id:integer, title:string, body:text)’



363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'activerecord/lib/active_record/core.rb', line 363

def inspect # :nodoc:
  if self == Base || singleton_class?
    super
  elsif abstract_class?
    "#{super}(abstract)"
  elsif !schema_loaded? && !connected?
    "#{super} (call '#{super}.load_schema' to load schema informations)"
  elsif table_exists?
    attr_list = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", "
    "#{super}(#{attr_list})"
  else
    "#{super}(Table doesn't exist)"
  end
end