Module: CassandraObject::BelongsTo

Extended by:
ActiveSupport::Autoload, ActiveSupport::Concern
Included in:
Base
Defined in:
lib/gotime-cassandra_object.rb,
lib/cassandra_object/belongs_to.rb,
lib/cassandra_object/belongs_to/builder.rb,
lib/cassandra_object/belongs_to/reflection.rb,
lib/cassandra_object/belongs_to/association.rb

Defined Under Namespace

Modules: ClassMethods Classes: Association, Builder, Reflection

Instance Method Summary collapse

Instance Method Details

#belongs_to_association(name) ⇒ Object

Returns the belongs_to instance for the given name, instantiating it if it doesn’t already exist



35
36
37
38
39
40
41
42
43
44
# File 'lib/cassandra_object/belongs_to.rb', line 35

def belongs_to_association(name)
  association = belongs_to_instance_get(name)

  if association.nil?
    association = CassandraObject::BelongsTo::Association.new(self, belongs_to_reflections[name])
    belongs_to_instance_set(name, association)
  end

  association
end