Sha256: 1b1c6642e7cff320a37b1584de8218bff7005536af20af5315693e838daa043d

Contents?: true

Size: 753 Bytes

Versions: 5

Compression:

Stored size: 753 Bytes

Contents

module ActiveMetadata

  class Attachment < ActiveRecord::Base

    include ::Paperclip
    include ::Paperclip::Glue

    has_attached_file :attach,
                      :path => "#{ActiveMetadata::CONFIG['attachment_base_path']}/:document_class/:document_id/:label/:id/:basename.:extension",
                      :url => "#{ActiveMetadata::CONFIG['attachment_base_url']}/:document_class/:document_id/:label/:id/"

    Paperclip.interpolates :document_id do |attachment, style|
      attachment.instance.document_id
    end

    Paperclip.interpolates :label do |attachment, style|
      attachment.instance.label
    end

    Paperclip.interpolates :document_class do |attachment, style|
      attachment.instance.document_class
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_metadata-0.6.4 app/models/active_metadata/attachment.rb
active_metadata-0.6.3 app/models/active_metadata/attachment.rb
active_metadata-0.6.2 app/models/active_metadata/attachment.rb
active_metadata-0.6.1 app/models/active_metadata/attachment.rb
active_metadata-0.6.0 app/models/active_metadata/attachment.rb