Sha256: f408c0a1e3b6d8665452552a65950d83e19de765f6a57d3ab4220964ed693c4f

Contents?: true

Size: 530 Bytes

Versions: 87

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  # If the model has a +elements+ association,
  # it updates all their timestamps after save.
  #
  # Should only be used on bottom to top relations,
  # e.g. +Alchemy::Picture+ or +Alchemy::Attachment+
  # not on top to bottom ones like +Alchemy::Page+.
  #
  module TouchElements
    def self.included(base)
      base.after_update(:touch_elements)
    end

    private

    def touch_elements
      return unless respond_to?(:elements)

      elements.touch_all
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
alchemy_cms-7.3.4 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.3.3 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.3.2 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.7 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.3.1 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.3.0 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.6 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.5 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.12 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.15 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-6.1.10 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.4 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.11 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.3 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.10 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.2 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.9 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.14 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.2.1 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.13 app/models/concerns/alchemy/touch_elements.rb