module Traits::Association::Members

Public Instance Methods

from() click to toggle source
# File lib/traits/association/members.rb, line 7
def from
  @from_active_record.traits
end
from_active_record() click to toggle source

Returns the actual association establisher class

# File lib/traits/association/members.rb, line 12
def from_active_record
  @from_active_record
end
self_to_self?() click to toggle source
# File lib/traits/association/members.rb, line 25
def self_to_self?
  from_active_record == to_active_record
end
to() click to toggle source

Returns the actual associated class

# File lib/traits/association/members.rb, line 17
def to
  reflection.klass.traits unless polymorphic?
end
to_active_record() click to toggle source
# File lib/traits/association/members.rb, line 21
def to_active_record
  reflection.klass unless polymorphic?
end
to_hash() click to toggle source
Calls superclass method
# File lib/traits/association/members.rb, line 29
def to_hash
  super.merge!(
    from:         from.name,
    to:           to.try(:name),
    self_to_self: self_to_self?
  )
end