2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-31 14:05:14 +00:00

another temp helper: pool:*

--HG--
branch : moe
extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%4035
This commit is contained in:
petopeto
2010-08-26 21:19:46 +00:00
parent 56fb6fb141
commit 70d401f2f9

View File

@@ -164,9 +164,13 @@ module PostSqlMethods
end
if q[:pool].is_a?(String)
joins << "JOIN pools_posts ON pools_posts.post_id = p.id JOIN pools ON pools_posts.pool_id = pools.id"
conds << "pools.name ILIKE ? ESCAPE E'\\\\'"
cond_params << ("%" + q[:pool].to_escaped_for_sql_like + "%")
if q[:pool] == "*" then
joins << "JOIN pools_posts ON pools_posts.post_id = p.id JOIN pools ON pools_posts.pool_id = pools.id"
else
joins << "JOIN pools_posts ON pools_posts.post_id = p.id JOIN pools ON pools_posts.pool_id = pools.id"
conds << "pools.name ILIKE ? ESCAPE E'\\\\'"
cond_params << ("%" + q[:pool].to_escaped_for_sql_like + "%")
end
end
end