Initial commit
This commit is contained in:
12
app/models/file_info.rb
Normal file
12
app/models/file_info.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class FileInfo < ApplicationRecord
|
||||
belongs_to :releasable, polymorphic: true
|
||||
|
||||
scope :audio, -> { where("content_type ILIKE ?", "%audio%") }
|
||||
scope :video, -> { where("content_type ILIKE ?", "%video%") }
|
||||
scope :photo, -> { where("content_type ILIKE ?", "%image%") }
|
||||
scope :other, -> { where("NOT content_type ILIKE ?", "%(image|video|audio)%") }
|
||||
|
||||
def self.search_filename(query)
|
||||
where("filename ILIKE ?", "%#{query}%")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user