summaryrefslogtreecommitdiff
path: root/app/models/asset.rb
blob: 4a20d737f600b90b4e56491497dda02fce680831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Asset < ActiveRecord::Base
  has_attached_file(
    :upload,
    :styles => {
      :normal => "450x450", 
      :medium => "300x300", 
      :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