Add Docker and Travis config files to enable CI tests

Also fixes some Rails 6.0 deprecation warnings
This commit is contained in:
Albert Yi
2018-05-01 15:24:24 -07:00
parent fee9acc8a7
commit 79ea6f7e6c
18 changed files with 138 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ class BulkUpdateRequest < ApplicationRecord
before_validation :normalize_text
after_create :create_forum_topic
scope :pending_first, lambda { order("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)") }
scope :pending_first, lambda { order(Arel.sql("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)")) }
scope :pending, ->{where(status: "pending")}
scope :expired, ->{where("created_at < ?", TagRelationship::EXPIRY.days.ago)}
scope :old, ->{where("created_at between ? and ?", TagRelationship::EXPIRY.days.ago, TagRelationship::EXPIRY_WARNING.days.ago)}

View File

@@ -38,7 +38,7 @@ class Pool < ApplicationRecord
end
def series_first
order("(case pools.category when 'series' then 0 else 1 end), pools.name")
order(Arel.sql("(case pools.category when 'series' then 0 else 1 end), pools.name"))
end
def name_matches(name)

View File

@@ -73,7 +73,7 @@ class SavedSearch < ApplicationRecord
def self.labels_for(user_id)
Cache.get(cache_key(user_id)) do
SavedSearch.where(user_id: user_id).order("label").pluck("distinct unnest(labels) as label")
SavedSearch.where(user_id: user_id).order("label").pluck(Arel.sql("distinct unnest(labels) as label"))
end
end

View File

@@ -70,7 +70,7 @@ class TagRelationship < ApplicationRecord
end
def pending_first
order("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name")
order(Arel.sql("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name"))
end
def active