-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Count on tagged_with / group_by query #405
Comments
I'm experiencing this as well. |
Found a fix and issued a pull request: |
Thx for the workaround @rgould ! I was still experimenting this problem. |
Trying to get master tests reliably passing, then will start merging again soon :) |
OK I'll test it against your merge as soon as you'll release it ! |
My table definition create_table "criterions", force: true do |t|
t.integer "user_id"
t.integer "minimum_salary"
...
end The class itself : class Criterion < ActiveRecord::Base
acts_as_ordered_taggable_on :skills
... The request that fails without the monkey patch of @rgould Criterion.tagged_with(["java"], on: :skills).group(:minimum_salary).count SELECT COUNT(*) AS count_all, AS , minimum_salary AS minimum_salary FROM "criterions" JOIN taggings criterions_taggings_68443c0 ON criterions_taggings_68443c0.taggable_id = "criterions".id AND criterions_taggings_68443c0.taggable_type = 'Criterion' AND criterions_taggings_68443c0.tag_id = 3312 AND criterions_taggings_68443c0.context = 'skills' GROUP BY minimum_salary You can see that there's a 'AS' in the middle of nowhere. group = [] # Rails interprets this as a no-op in the group() call below |
Can you rebase against master and force push? |
This query works perfectly
But adding a group_by clause breaks everything :
The text was updated successfully, but these errors were encountered: