application record: drop execute_sql, select_value_sql methods.

This commit is contained in:
evazion
2020-02-16 05:27:51 -06:00
parent 9caa9d8117
commit d3bbd82d8b
8 changed files with 19 additions and 69 deletions

View File

@@ -449,10 +449,10 @@ class PostQueryBuilder
relation = add_tag_string_search_relation(q[:tags], relation)
if q[:ordpool].present?
pool_id = q[:ordpool].to_i
pool_name = q[:ordpool]
# XXX unify with Pool#posts
pool_posts = Pool.joins("CROSS JOIN unnest(pools.post_ids) WITH ORDINALITY AS row(post_id, pool_index)").where(id: pool_id).select(:post_id, :pool_index)
pool_posts = Pool.named(pool_name).joins("CROSS JOIN unnest(pools.post_ids) WITH ORDINALITY AS row(post_id, pool_index)").select(:post_id, :pool_index)
relation = relation.joins("JOIN (#{pool_posts.to_sql}) pool_posts ON pool_posts.post_id = posts.id").order("pool_posts.pool_index ASC")
end