Module: OneAssociation
- Included in:
- OneEmbeddedAssociation, OneQueryAssociation, OneStoreAssociation
- Defined in:
- lib/yodel/models/core/associations/counts/one_association.rb
Instance Method Summary collapse
- #before_destroy(record) ⇒ Object
- #search_terms_set(record) ⇒ Object
- #typecast(value, record) ⇒ Object
Instance Method Details
#before_destroy(record) ⇒ Object
7 8 9 10 11 |
# File 'lib/yodel/models/core/associations/counts/one_association.rb', line 7 def before_destroy(record) if @options['destroy'] == true record.get(name).try(:destroy) end end |
#search_terms_set(record) ⇒ Object
2 3 4 5 |
# File 'lib/yodel/models/core/associations/counts/one_association.rb', line 2 def search_terms_set(record) return [] unless include_in_search_keywords? record.get(name).try(:search_terms) || [] end |
#typecast(value, record) ⇒ Object
13 14 15 16 |
# File 'lib/yodel/models/core/associations/counts/one_association.rb', line 13 def typecast(value, record) return default if value.blank? associated(value, record) end |