Module: Gluttonberg::Library::AttachmentMixin

Included in:
Asset
Defined in:
lib/gluttonberg/library/attachment_mixin.rb

Overview

The attachment mixin encapsulates the majority of logic for handling and processing uploads. It exists here in a mixin rather than in the Asset class purely because it is ultimately the intention to have a different Asset class for each major category of assets e.g. ImageAsset, DocumentAsset.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gluttonberg/library/attachment_mixin.rb', line 11

def self.included(klass)
  klass.class_eval do
    after_destroy  :remove_file_from_storage
    before_save    :generate_reference_hash
    after_save     :update_file_on_storage
    attr_accessor  :file_dirty

    extend ClassMethods
    include InstanceMethods
    extend Library::Config::ImageSizes::ClassMethods
    include Library::Config::ImageSizes::InstanceMethods

    initialize_storage()
  end
end