Module: Cms::Fortress::FileMethods

Defined in:
lib/cms/fortress/file_methods.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cms/fortress/file_methods.rb', line 5

def self.included(base)

  base.class_eval do
    image_mimetypes = %w(gif jpeg pjpeg png tiff).collect{|subtype| "image/#{subtype}"}
    video_mimetypes = %w(mp4 ogg webm).collect{|subtype| "video/#{subtype}"}

    scope :videos, -> { where(:file_content_type => video_mimetypes) }
    scope :others,  -> { where('file_content_type NOT IN (?)', image_mimetypes + video_mimetypes) }

  end

end