Sha256: 2316fa0a151a03e339ff235bb3905833b6b19551757a1e9f8a66d4f52c094093

Contents?: true

Size: 540 Bytes

Versions: 14

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module ContentTouching
    def self.included(base)
      base.after_update(:touch_contents)
    end

    private

    # If the model has a +contents+ association,
    # it updates all their timestamps.
    #
    # CAUTION: Only use on bottom to top releations,
    # e.g. +Alchemy::Picture+ or +Alchemy::Attachment+
    # not on top to bottom ones like +Alchemy::Element+.
    #
    def touch_contents
      return unless respond_to?(:contents)
      contents.each(&:touch)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
alchemy_cms-4.3.2 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.4 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.3.1 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.3 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.3.0 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.2 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.1.2 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.1.1 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.1 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.0 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.2.0.rc1 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.1.0 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.1.0.rc1 app/models/concerns/alchemy/content_touching.rb
alchemy_cms-4.1.0.beta app/models/concerns/alchemy/content_touching.rb