Module: Torque::PostgreSQL::Relation::Initializer

Defined in:
lib/torque/postgresql/relation.rb

Overview

When a relation is created, force the attributes to be defined, because the type mapper may add new methods to the model. This happens for the given model Klass and its inheritances

Instance Method Summary collapse

Instance Method Details

#initialize(klass) ⇒ Object



121
122
123
124
125
126
# File 'lib/torque/postgresql/relation.rb', line 121

def initialize(klass, *)
  super

  klass.superclass.send(:relation) if klass.define_attribute_methods &&
    klass.superclass != ActiveRecord::Base && !klass.superclass.abstract_class?
end