class Superstore::Associations::Association

Attributes

owner[R]
reflection[R]

Public Class Methods

new(owner, reflection) click to toggle source
# File lib/superstore/associations/association.rb, line 7
def initialize(owner, reflection)
  @owner = owner
  @reflection = reflection
  reset
end

Public Instance Methods

association_class() click to toggle source
# File lib/superstore/associations/association.rb, line 13
def association_class
  association_class_name.constantize
end
association_class_name() click to toggle source
# File lib/superstore/associations/association.rb, line 17
def association_class_name
  reflection.polymorphic? ? owner.send(reflection.polymorphic_column) : reflection.class_name
end
loaded!() click to toggle source
# File lib/superstore/associations/association.rb, line 34
def loaded!
  @loaded = true
end
loaded?() click to toggle source
# File lib/superstore/associations/association.rb, line 30
def loaded?
  @loaded
end
reset() click to toggle source
# File lib/superstore/associations/association.rb, line 38
def reset
  @loaded = false
  @target = nil
end
target() click to toggle source
# File lib/superstore/associations/association.rb, line 26
def target
  @target
end
target=(target) click to toggle source
# File lib/superstore/associations/association.rb, line 21
def target=(target)
  @target = target
  loaded!
end