Sha256: 76a9e05ec1e21f79698eec32a7c799fbcd1faf6a63ec70a3e00daaf2d3c03e19
Contents?: true
Size: 563 Bytes
Versions: 16
Compression:
Stored size: 563 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.update_all(updated_at: Time.current) end end end
Version data entries
16 entries across 16 versions & 1 rubygems