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

Spotted two bugs in acts_as_taggable_on.rb #3

Closed
lemig opened this issue Apr 28, 2009 · 2 comments
Closed

Spotted two bugs in acts_as_taggable_on.rb #3

lemig opened this issue Apr 28, 2009 · 2 comments

Comments

@lemig
Copy link

lemig commented Apr 28, 2009

Hi,

This a great plugin. Here two small bugs.

in : find_options_for_find_tagged_with()
change : conditions << sanitize_sql(["context = ?",on.to_s])
to : conditions << sanitize_sql(["#{Tagging.table_name}.context = ?",on.to_s])

in : find_options_for_tag_counts()
change:
{ :select => "#{Tag.table_name}.id, #{Tag.table_name}.name, COUNT() AS count",
:joins => joins.join(" "),
:conditions => conditions,
:group => group_by
}
to :
{ :select => "#{Tag.table_name}.id, #{Tag.table_name}.name, COUNT(
) AS count",
:joins => joins.join(" "),
:conditions => conditions,
:group => group_by,
:order => options[:order]
}

Best regards,

miguel cabero

@lemig
Copy link
Author

lemig commented Apr 28, 2009

forget the first bug correction, here is the right change :
in : find_options_for_find_tagged_with()
change :

unless (on = options.delete(:on)).nil?
conditions << sanitize_sql(["#{context = ?",on.to_s])
end
taggings_alias, tags_alias = "#{table_name}_taggings", "#{table_name}_tags"

to :
taggings_alias, tags_alias = "#{table_name}_taggings", "#{table_name}_tags"
unless (on = options.delete(:on)).nil?
conditions << sanitize_sql(["#{taggings_alias}.context = ?",on.to_s])
end

@eet-nu
Copy link

eet-nu commented Nov 12, 2009

Pretty sure this is fixed now, as I rewrote find_options_for_find_tagged_with.

This issue was closed.
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

1 participant