Sha256: fc1a852782f974430506cda4cb857d375084e31e17bf0c71e4b5f9d35ef6e90b
Contents?: true
Size: 1.06 KB
Versions: 9
Compression:
Stored size: 1.06 KB
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 class << self def by_group(group, *args) options = args.extract_options! order_by = options.delete(:order_by) || "created_at DESC" ActiveMetadata::Attachment.all(:conditions => options.merge(:group => group), :order => order_by) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems