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.1.8 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.7 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.12 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.11 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.6 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.5 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.10 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.4 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.9 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.3 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.2 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.1 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.0 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.0.pre.rc1 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.0.pre.b2 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.1.0.pre.b1 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.8 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.7 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.6 app/models/concerns/alchemy/touch_elements.rb
alchemy_cms-7.0.5 app/models/concerns/alchemy/touch_elements.rb