1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Fix invalid SQL in ransacker with arguments

This commit is contained in:
sineed 2015-03-15 17:29:00 +03:00
parent ad60dbf4b6
commit c90fb5c008

View file

@ -70,10 +70,11 @@ class Person < ActiveRecord::Base
ransacker :with_passed_arguments, args: [:parent, :ransacker_args] do |parent, args|
min_body, max_body = args
sql = <<-SQL
(SELECT title
(SELECT MAX(articles.title)
FROM articles
WHERE articles.person_id = people.id
AND CHAR_LENGTH(articles.body) BETWEEN #{min_body} AND #{max_body}
GROUP BY articles.person_id
)
SQL
Arel.sql(sql.squish)