Sha256: fbfc86270a01c0083700f1e15d6602b17f9c64f4a3a00a821d4ac2d139ded91b
Contents?: true
Size: 582 Bytes
Versions: 9
Compression:
Stored size: 582 Bytes
Contents
module YariiEditor module ModelCallbacks extend ActiveSupport::Concern included do after_save :add_to_repository_index around_destroy :remove_from_repository end def add_to_repository_index if persisted? CurrentSite.site&.repository&.add(file_path) CurrentSite.site&.build_preview end end def remove_from_repository if persisted? past_file_path = file_path yield CurrentSite.site&.repository&.remove(past_file_path) CurrentSite.site&.build_preview end end end end
Version data entries
9 entries across 9 versions & 1 rubygems