-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 4.1.0.beta1: pg_search_scope produced invalid SQL #153
Comments
Having the same problem, also on 4.1.0.beta1. |
Interesting. I wonder if this is a problem with pg_search or with Rails. I've had to make some pull requests to Rails to fix similar issues in the past. I'll look into this soon. |
Thanks Grant. For now, a workaround (Post.all.to_a.count) will do, but it’s not ideal for large numbers of posts. On Jan 5, 2014, at 5:28 PM, Grant Hutchins notifications@github.com wrote:
|
I just read this Rails pull request rails/rails#10710 which is what introduced this problem. It seems that the solution is to use Does this work for you? Page.by_title('test').count(:all) |
Also, it seems that this commit was reverted on 4.0.0 Rails but not on master (where 4.1.0 is being developed). I'm unsure whether this was purposeful. |
Yes, it works for me: Page.by_title('test').count(:all) The problem is in rails API changed in 4.1.0.beta1. |
I was having the same issue and tried several things proposed here (will_paginate-bootstrap, kaminari, count(:all)). Finally what seems to have worked is Kaminari and getting rid of a "in_groups_of(3)" that I was calling in a view. Hope this helps others! |
Given model Page with "title" attribute and search scope:
This works as expected:
But if call count method...
PostgreSQL complains:
The text was updated successfully, but these errors were encountered: