Module: ROM::SQL::Associations::SelfRef

Included in:
ManyToMany, ManyToOne, OneToMany
Defined in:
lib/rom/sql/associations/self_ref.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
# File 'lib/rom/sql/associations/self_ref.rb', line 7

def self.included(klass)
  super
  klass.memoize :join_keys, :source_table, :source_alias, :source_attr, :target_attr
end

Instance Method Details

#join_keysObject



13
14
15
# File 'lib/rom/sql/associations/self_ref.rb', line 13

def join_keys
  { source_attr => target_attr }
end

#source_attrObject



18
19
20
# File 'lib/rom/sql/associations/self_ref.rb', line 18

def source_attr
  source[source_key].qualified(source_alias)
end

#target_attrObject



23
24
25
# File 'lib/rom/sql/associations/self_ref.rb', line 23

def target_attr
  target[target_key].qualified
end