New class method popular_tags #13

Merged
merged 3 commits into from Jun 8, 2012

Conversation

Projects
None yet
2 participants
Contributor

mlitwiniuk commented May 5, 2012

I've added new class method popular_tags, that lists tags ordered by times used for given model (with possibility to specify extra context).

Looks good but ....

Have a look at the magic line at 121

    r = self.class.from("(#{inner.to_sql}) #{self.class.table_name}")

without this hack / bit of genius chaining further active-relation queries to the end becomes problematic. The
reason for this is the way group works. For chaining active relation you would like the upstream query to behave
like a table you can query without worrying how it is constructed. This bit of wrapping code above makes the
output of the method clean and isolates the user from knowing or caring that a group by clause was used.

Add this in and I will pull the request.

Thanks for the work.

Contributor

mlitwiniuk commented Jun 2, 2012

Here you go :)

Super. Thanks :)

bradphelan added a commit that referenced this pull request Jun 8, 2012

Merge pull request #13 from mlitwiniuk/master
New class method popular_tags

@bradphelan bradphelan merged commit 468d05b into bradphelan:master Jun 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment