Skip to content

Commit

Permalink
cleanup, up mysql to 2nd version
Browse files Browse the repository at this point in the history
  • Loading branch information
artemk committed Aug 1, 2011
1 parent 79a1209 commit c1e5b45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
Expand Up @@ -85,7 +85,6 @@ def tagged_with(tags, options = {})
# get tags, drop out if nothing returned (we need at least one)
tags = ActsAsTaggableOn::Tag.named_any(tag_list)
return scoped(:conditions => "1 = 0") unless tags.length > 0
# conditions << tag_list.map { |t| sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ?", t]) }.join(" OR ")

# setup taggings alias so we can chain, ex: items_locations_taggings_awesome_cool_123
# avoid ambiguous column name
Expand All @@ -105,24 +104,12 @@ def tagged_with(tags, options = {})

joins << tagging_join

# tagging_join = " JOIN #{ActsAsTaggableOn::Tagging.table_name}" +
# " ON #{ActsAsTaggableOn::Tagging.table_name}.taggable_id = #{table_name}.#{primary_key}" +
# " AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name)}" +
# " JOIN #{ActsAsTaggableOn::Tag.table_name}" +
# " ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.id"
#
# tagging_join << " AND " + sanitize_sql(["#{ActsAsTaggableOn::Tagging.table_name}.context = ?", context.to_s]) if context
# select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one?
#
# joins << tagging_join

else
tags = ActsAsTaggableOn::Tag.named_any(tag_list)
return empty_result unless tags.length == tag_list.length

tags.each do |tag|
safe_tag = tag.name.gsub(/[^a-zA-Z0-9]/, '')
prefix = "#{safe_tag}_#{rand(1024)}"
prefix = "#{tag.safe_name}_#{rand(1024)}"

taggings_alias = "#{alias_base_name}_taggings_#{prefix}"

Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/compatibility/Gemfile
Expand Up @@ -4,5 +4,5 @@ source :gemcutter
gem 'rails', '2.3.5'
gem 'rspec', '1.3.0', :require => 'spec'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'mysql2'
gem 'mysql2', '~> 0.2.7'
gem 'pg'

0 comments on commit c1e5b45

Please sign in to comment.