Module: ActiveAssociation

Included in:
Extent
Defined in:
backend/app/model/mixins/active_association.rb

Instance Method Summary collapse

Instance Method Details

#active_associationObject



3
4
5
6
# File 'backend/app/model/mixins/active_association.rb', line 3

def active_association
  association_type = find_associated_type
  association_type ? self.send(association_type) : nil
end

#broadcast_reindexObject



8
9
10
# File 'backend/app/model/mixins/active_association.rb', line 8

def broadcast_reindex
  active_association.update(system_mtime: Time.now) if active_association
end

#find_associated_typeObject



12
13
14
# File 'backend/app/model/mixins/active_association.rb', line 12

def find_associated_type
  self.class.associations.find { |type| self.send(type) }
end