From 7563dd7ef8b9bc6ba61e90976c5b5a1714230fb2 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 27 Apr 2009 11:19:20 +0200 Subject: named scopes for media types --- app/models/asset.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/models/asset.rb b/app/models/asset.rb index c9c6296..4a20d73 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -7,4 +7,29 @@ class Asset < ActiveRecord::Base :thumb => "100x100", } ) + + named_scope :images, :conditions => { + :upload_content_type => [ + "image/gif", + "image/jpeg", + "image/png" + ] + } + + named_scope :documents, :conditions => { + :upload_content_type => [ + "application/pdf", + "text/plain", + "text/rtf" + ] + } + + named_scope :audio, :conditions => { + :upload_content_type => [ + "audio/mpeg", + "audio/x-m4a", + "audio/wav", + "audio/x-wav" + ] + } end -- cgit v1.3