Sha256: 0352a8f8a8b5ab750788a5e11abec153a1afda0cf39c8339a50d597c4bf3d97d

Contents?: true

Size: 665 Bytes

Versions: 4

Compression:

Stored size: 665 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_metadata-0.5.2 lib/model/active_record/attachment.rb
active_metadata-0.5.1 lib/model/active_record/attachment.rb
active_metadata-0.5.0 lib/model/active_record/attachment.rb
active_metadata-0.4.2 lib/model/active_record/attachment.rb