Sha256: a89ef6ebd86dfa703084fc4bad920e71b24960e88ab80fdd319a56d13360909c

Contents?: true

Size: 805 Bytes

Versions: 5

Compression:

Stored size: 805 Bytes

Contents

module ActiveMetadata

  class Attachment < ActiveRecord::Base
    self.table_name = "active_metadata_attachments"

    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.7.0 app/models/active_metadata/attachment.rb
active_metadata-0.6.9 app/models/active_metadata/attachment.rb
active_metadata-0.6.7 app/models/active_metadata/attachment.rb
active_metadata-0.6.6 app/models/active_metadata/attachment.rb
active_metadata-0.6.5 app/models/active_metadata/attachment.rb