@@ -263,10 +263,30 @@ class Artist < ActiveRecord::Base
|
||||
q = q.reorder("id desc")
|
||||
end
|
||||
|
||||
if params[:is_active] == "true"
|
||||
q = q.active
|
||||
elsif params[:is_active] == "false"
|
||||
q = q.where("is_active = false")
|
||||
end
|
||||
|
||||
if params[:is_banned] == "true"
|
||||
q = q.banned
|
||||
elsif params[:is_banned] == "false"
|
||||
q = q.where("is_banned = false")
|
||||
end
|
||||
|
||||
if params[:id].present?
|
||||
q = q.where("id = ?", params[:id])
|
||||
end
|
||||
|
||||
if params[:creator_name].present?
|
||||
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].tr(" ", "_").mb_chars.downcase)
|
||||
end
|
||||
|
||||
if params[:creator_id].present?
|
||||
q = q.where("creator_id = ?", params[:creator_id].to_i)
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,6 +29,18 @@ class ArtistVersion < ActiveRecord::Base
|
||||
q = q.reorder("id desc")
|
||||
end
|
||||
|
||||
if params[:is_active] == "true"
|
||||
q = q.where("is_active = true")
|
||||
elsif params[:is_active] == "false"
|
||||
q = q.where("is_active = false")
|
||||
end
|
||||
|
||||
if params[:is_banned] == "true"
|
||||
q = q.where("is_banned = true")
|
||||
elsif params[:is_banned] == "false"
|
||||
q = q.where("is_banned = false")
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,6 +42,12 @@ class Pool < ActiveRecord::Base
|
||||
q = q.where("creator_id = ?", params[:creator_id].to_i)
|
||||
end
|
||||
|
||||
if params[:is_active] == "true"
|
||||
q = q.where("is_active = true")
|
||||
elsif params[:is_active] == "false"
|
||||
q = q.where("is_active = false")
|
||||
end
|
||||
|
||||
if params[:sort] == "name"
|
||||
q = q.order("name")
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user