Sha256: 60b538e085dd0e1c6cac75e63a326b7ee1318efe645c3091be414b5d443131a7

Contents?: true

Size: 439 Bytes

Versions: 38

Compression:

Stored size: 439 Bytes

Contents

module Alchemy
  module Picture::Sweeping
    extend ActiveSupport::Concern

    included do
      after_update  { expire_cache_for(self) }
      after_destroy { expire_cache_for(self) }
    end

    private

    # Removing all variants of the picture with FileUtils.
    def expire_cache_for(picture)
      FileUtils.rm_rf(Rails.root.join('public', Alchemy::MountPoint.get.gsub(/^\//, ''), 'pictures', picture.id.to_s))
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
alchemy_cms-3.4.2 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.5.0.rc1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.4.1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.3 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.2 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.4.0 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.4.0.rc1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.0 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.0.rc2 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.3.0.rc1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.2.1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.1.3 app/models/alchemy/picture/sweeping.rb
lc_alchemy_cms-3.2.1 app/models/alchemy/picture/sweeping.rb
lc_alchemy_cms-3.2.0 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.2.0 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.2.0.rc1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.2.0.beta app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.1.1 app/models/alchemy/picture/sweeping.rb
alchemy_cms-3.0.4 app/models/alchemy/picture/sweeping.rb