Module: Correspondence::With::ClassMethods

Defined in:
lib/correspondence/with.rb

Instance Method Summary collapse

Instance Method Details

#correspondencesObject



18
19
20
# File 'lib/correspondence/with.rb', line 18

def correspondences
  @correspondences ||= Hash.new
end

#corresponds_with(association, options = {}, &block) ⇒ Object



13
14
15
16
# File 'lib/correspondence/with.rb', line 13

def corresponds_with(association, options={}, &block)
  type = plural_association?(association) ? 'Many' : 'One'
  correspondences[association.to_sym] = const_get("#{type}Proxy").new(self, association, options)
end