aliases/implications: fix ambiguous column reference on index page.
Fix searches like this:
https://danbooru.donmai.us/tag_aliases?search[consequent_tag][category]=1&search[order]=created_at
failing with an ambiguous column reference.
This commit is contained in:
@@ -91,13 +91,13 @@ class TagRelationship < ApplicationRecord
|
|||||||
|
|
||||||
case params[:order].to_s.downcase
|
case params[:order].to_s.downcase
|
||||||
when "created_at"
|
when "created_at"
|
||||||
q = q.order("created_at desc")
|
q = q.order(created_at: :desc)
|
||||||
when "updated_at"
|
when "updated_at"
|
||||||
q = q.order("updated_at desc")
|
q = q.order(updated_at: :desc)
|
||||||
when "name"
|
when "name"
|
||||||
q = q.order("antecedent_name asc, consequent_name asc")
|
q = q.order(antecedent_name: :asc, consequent_name: :asc)
|
||||||
when "tag_count"
|
when "tag_count"
|
||||||
q = q.joins(:consequent_tag).order("tags.post_count desc, antecedent_name asc, consequent_name asc")
|
q = q.joins(:consequent_tag).order("tags.post_count DESC", antecedent_name: :asc, consequent_name: :asc)
|
||||||
else
|
else
|
||||||
q = q.apply_default_order(params)
|
q = q.apply_default_order(params)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user