Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

26
app/models/download.rb Normal file
View File

@@ -0,0 +1,26 @@
class Download < ApplicationRecord
include PgSearch
belongs_to :project
has_one_attached :file
enum status: { not_started: 0, pending: 1, success: 2, failure: 3 }
scope :unfinished_desc_order, -> { where(status: [:not_started, :pending]).order("created_at DESC") }
def self.searchable_on(fields)
search_opts = {
against: fields,
using: {
tsearch: { any_word: true, prefix: true },
trigram: {},
dmetaphone: { any_word: true },
}
}
send(:pg_search_scope, :search, search_opts)
end
searchable_on %i[name release_type]
end