Sha256: e1c7618a876d9caf1209867439a5996aaea15db14867d09cd57d94a8ba850580
Contents?: true
Size: 1.04 KB
Versions: 14
Compression:
Stored size: 1.04 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']}/:model_class/:model_id/:label/:id/:basename.:extension", :url => "#{ActiveMetadata::CONFIG['attachment_base_url']}/:model_class/:model_id/:label/:id/" Paperclip.interpolates :model_id do |attachment, style| attachment.instance.model_id end Paperclip.interpolates :label do |attachment, style| attachment.instance.label end Paperclip.interpolates :model_class do |attachment, style| attachment.instance.model_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
14 entries across 14 versions & 1 rubygems