Module: TbLiquid::ActsAsLiquidTag

Extended by:
ActiveSupport::Concern
Defined in:
app/concerns/tb_liquid/acts_as_liquid_tag.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#expire_tb_liquid_tagsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/concerns/tb_liquid/acts_as_liquid_tag.rb', line 9

def expire_tb_liquid_tags
  value_property = self.class.tb_liquid_tag_value_property
  values = [self.send(value_property)]
  if self.respond_to?("#{value_property}_changed?") && self.send("#{value_property}_changed?")
    values << self.send("#{value_property}_was")
  end
  ::SpudLiquidTag.where(:tag_name => self.class.tb_liquid_tag_name, :value => values).includes(:attachment).each do |tag|
    attachment = tag.attachment
    if attachment.respond_to?(:postprocess_content)
      attachment.postprocess_content()
      attachment.save()
    else
      logger.debug "SpudLiquidTag attachment of class #{attachment.class} does not implement :postprocess_content."
    end
  end
end