Sha256: fcbda108bccd325966bfed32127d844536bc09819fe7e521b060baadfaeccdf8

Contents?: true

Size: 444 Bytes

Versions: 19

Compression:

Stored size: 444 Bytes

Contents

module Alchemy
	class PicturesSweeper < ActionController::Caching::Sweeper
		observe Alchemy::Picture

		def after_update(picture)
			expire_cache_for(picture)
		end

		def after_destroy(picture)
			expire_cache_for(picture)
		end

	private

		def expire_cache_for(picture)
			# Removing all variants of the picture with FileUtils.
			FileUtils.rm_rf(Rails.root.join('public', Alchemy.mount_point, 'pictures', picture.id.to_s))
		end

	end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
alchemy_cms-2.1.12 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.11 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.9.1 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.9 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.8.1 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.8 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.7 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.6 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.5 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.4 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.3 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.2 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.1 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.rc6 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.rc5 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.rc4 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.rc3 app/sweepers/alchemy/pictures_sweeper.rb
alchemy_cms-2.1.rc2 app/sweepers/alchemy/pictures_sweeper.rb