module Traits::Association::Through

Public Instance Methods

source_association() click to toggle source
# File lib/traits/association/through.rb, line 29
def source_association
  if through?
    through.associations[reflection.source_reflection.name]
  end
end
source_association_name() click to toggle source
# File lib/traits/association/through.rb, line 35
def source_association_name
  source_association.try(:name)
end
through() click to toggle source
# File lib/traits/association/through.rb, line 11
def through
  if through?
    reflection.through_reflection.klass.traits
  end
end
through?() click to toggle source
# File lib/traits/association/through.rb, line 7
def through?
  reflection.through_reflection.present?
end
through_association() click to toggle source
# File lib/traits/association/through.rb, line 23
def through_association
  if through?
    from.associations[reflection.through_reflection.name]
  end
end
through_association_name() click to toggle source
# File lib/traits/association/through.rb, line 39
def through_association_name
  if through?
    through_association.name
  end
end
through_class() click to toggle source
# File lib/traits/association/through.rb, line 17
def through_class
  if through?
    through.active_record
  end
end
through_from_key_name() click to toggle source
# File lib/traits/association/through.rb, line 57
def through_from_key_name
  if through?
    source_association.from_key_name
  end
end
through_table_name() click to toggle source
# File lib/traits/association/through.rb, line 45
def through_table_name
  if through?
    through_association.to_table_name
  end
end
through_to_key_name() click to toggle source
# File lib/traits/association/through.rb, line 51
def through_to_key_name
  if through?
    through_association.to_key_name
  end
end
to_hash() click to toggle source
Calls superclass method
# File lib/traits/association/through.rb, line 63
def to_hash
  super.merge!(
    through:               through.try(:name),
    through_association:   through_association_name,
    source_association:    source_association_name,
    through_table_name:    through_table_name,
    through_to_key_name:   through_to_key_name,
    through_from_key_name: through_from_key_name
  )
end