Spec-Zone.ru › Ruby on Rails 5.1

модуль ActiveRecord::Core::ClassMethods

Открытые методы экземпляра

===(объект) Показать исходный код
# File activerecord/lib/active_record/core.rb, line 262
def ===(object)
  object.is_a?(self)
end

Переопределяет метод равенства по умолчанию для классов, чтобы поддерживать прокси-объекты ассоциаций.

allocate() Показать исходный код
# File activerecord/lib/active_record/core.rb, line 153
def allocate
  define_attribute_methods
  super
end
Вызывает метод родительского класса
generated_association_methods() Показать исходный код
# File activerecord/lib/active_record/core.rb, line 235
def generated_association_methods
  @generated_association_methods ||= begin
    mod = const_set(:GeneratedAssociationMethods, Module.new)
    private_constant :GeneratedAssociationMethods
    include mod

    mod
  end
end
inspect() Показать исходный код
# File activerecord/lib/active_record/core.rb, line 246
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 = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", "
    "#{super}(#{attr_list})"
  else
    "#{super}(Table doesn't exist)"
  end
end

Возвращает строку, похожую на 'Post(id:integer, title:string, body:text)'

Вызывает метод родительского класса

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API