Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Commit

Permalink
don't include empty arrays, particularly on scope[:joins] because sco…
Browse files Browse the repository at this point in the history
…pe[:joins].to_s returns strings like #<ActiveRecord::Relation:0x5021304> breaking the subsequent 'joins.join(" ")'

Signed-off-by: Joel Nimety <jnimety@continuity.net>
  • Loading branch information
Joel Nimety authored and jviney committed Sep 21, 2010
1 parent a5e855a commit ec56014
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/acts_as_taggable.rb
Expand Up @@ -147,8 +147,8 @@ def find_options_for_tag_counts(options = {})
conditions = conditions.join(" AND ")

joins = ["INNER JOIN #{table_name} ON #{table_name}.#{primary_key} = #{Tagging.table_name}.taggable_id"]
joins << options.delete(:joins) if options[:joins]
joins << scope[:joins] if scope && scope[:joins]
joins << options.delete(:joins) if options[:joins].present?
joins << scope[:joins] if scope && scope[:joins].present?
joins = joins.join(" ")

options = { :conditions => conditions, :joins => joins }.update(options)
Expand Down

0 comments on commit ec56014

Please sign in to comment.