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:
parent
ad60dbf4b6
commit
c90fb5c008
1 changed files with 2 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue