module ActiveRecord::Core::ClassMethods

Public Instance Methods

===(object) Show source

Overwrite the default class equality method to provide support for association proxies.

# File activerecord/lib/active_record/core.rb, line 138
def ===(object)
  object.is_a?(self)
end
generated_association_methods() Show source
# File activerecord/lib/active_record/core.rb, line 113
def generated_association_methods
  @generated_association_methods ||= begin
    mod = const_set(:GeneratedAssociationMethods, Module.new)
    include mod
    mod
  end
end
initialize_generated_modules() Show source
# File activerecord/lib/active_record/core.rb, line 109
def initialize_generated_modules
  generated_association_methods
end
inspect() Show source

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

Calls superclass method
# File activerecord/lib/active_record/core.rb, line 122
def inspect
  if self == Base
    super
  elsif abstract_class?
    "#{super}(abstract)"
  elsif !connected?
    "#{super} (call '#{super}.connection' to establish a connection)"
  elsif table_exists?
    attr_list = columns.map { |c| "#{c.name}: #{c.type}" } * ', '
    "#{super}(#{attr_list})"
  else
    "#{super}(Table doesn't exist)"
  end
end

© 2004–2016 David Heinemeier Hansson
Licensed under the MIT License.