Skip to content
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

tagged_with should have option to exclude tag counts and order_by #38

Open
dignoe opened this issue Nov 16, 2012 · 1 comment
Open

tagged_with should have option to exclude tag counts and order_by #38

dignoe opened this issue Nov 16, 2012 · 1 comment

Comments

@dignoe
Copy link

dignoe commented Nov 16, 2012

We have to use Model.tagged_with() in a complicated sql query that is used within another sql query for the purposes of getting the MAX(table.updated_at) for a cache key. The current implementation adds complexity (and therefore processing time) to the query by always forcing

select{count(tags.id).as( tags_count)}.
select{"#{t}.*"}.
order("tags_count desc")

This also creates a MySQL error (duplicate column) when paired with .select("table_name.updated_at"). So that Model.select('table_name.updated_at').tagged_with(['my','tags']) fails.

I'm forking this project and will attempt a patch and pull request.

@thbar
Copy link

thbar commented Mar 4, 2013

Seconded - I was fairly surprised to see that there was this cound, and now the alias query too.

Having a way to disable counting and alias tags at query time would be neat.

@dignoe I'm going to extract the query for just retrieving the tagged objects, but if you already did that, could you please share it? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants