Can you open up a github issue for this? Also include the active record code that was used to generate the error, please try with Active Record 3.2.9 to make sure the bug hasn't been fixed there already. Please re-write any custom active record methods such as `tagged_with` with the plain old active record, to clearly demonstrate how to reproduce the error with only active record.
Github issues is the best place for bug reports. -- Richard Schneeman http://heroku.com @schneems (http://twitter.com/schneems) On Sunday, December 23, 2012 at 8:22 AM, Manuel Meurer wrote: > Hi all, > > I encountered an error in ActiveRecord when using subqueries. > > NoMethodError: undefined method `left' for :count:Symbol > # > /Users/me/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/associations/alias_tracker.rb:64:in > `block in initial_count_for' > > > (See the full stack trace here: https://gist.github.com/4363280) > > This is the offending SQL query: > > SELECT "taggable_models".* FROM (SELECT count("tags"."id") AS tags_count, > taggable_models.* FROM "taggable_models" INNER JOIN "taggings" ON > "taggings"."taggable_id" = "taggable_models"."id" AND > "taggings"."taggable_type" = 'TaggableModel' INNER JOIN "tags" ON "tags"."id" > = "taggings"."tag_id" WHERE "tags"."name" IN ('foo') GROUP BY > "taggable_models"."id", "taggable_models"."user_id", > "taggable_models"."name", "taggable_models"."type", "taggable_models"."foo" > ORDER BY tags_count desc) taggable_models > > Can anyone see something crazy with this immediately? > Is the "SELECT count("tags"."id") AS tags_count, taggable_models.* ..."-style > subquery bad in general? > > (from https://github.com/bradphelan/rocket_tag/issues/47) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/DJupqZfGhe8J. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
