Module: ManyAssociation

Included in:
ManyEmbeddedAssociation, ManyQueryAssociation, ManyStoreAssociation
Defined in:
lib/yodel/models/core/associations/counts/many_association.rb

Instance Method Summary collapse

Instance Method Details

#before_destroy(record) ⇒ Object



9
10
11
12
13
# File 'lib/yodel/models/core/associations/counts/many_association.rb', line 9

def before_destroy(record)
  if @options['destroy'] == true
    record.get(name).each(&:destroy)
  end
end

#search_terms_set(record) ⇒ Object



2
3
4
5
6
7
# File 'lib/yodel/models/core/associations/counts/many_association.rb', line 2

def search_terms_set(record)
  return [] unless include_in_search_keywords?
  record.get(name).collect do |embedded_record|
    embedded_record.search_terms
  end.flatten
end

#typecast(value, record) ⇒ Object



15
16
17
# File 'lib/yodel/models/core/associations/counts/many_association.rb', line 15

def typecast(value, record)
  ChangeSensitiveArray.new(record, name, all(value, record))
end