module Qbrick::TouchPlaceholders

Public Class Methods

included(base) click to toggle source
# File lib/qbrick/touch_placeholders.rb, line 5
def self.included(base)
  base.extend(ClassMethods)

  base.class_eval do
    after_save :touch_placeholders
  end
end

Public Instance Methods

touch_placeholders() click to toggle source
# File lib/qbrick/touch_placeholders.rb, line 13
def touch_placeholders
  return unless self.class.placeholder_templates.present?
  self.class.placeholder_templates.each do |template_name|
    related_templates = Qbrick::PlaceholderBrick.where(template_name: template_name)
    related_templates.each(&:touch) if related_templates
  end
end