acts-as-taggable-on 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.14
1
+ 1.0.15
@@ -139,9 +139,9 @@ module ActiveRecord
139
139
  end
140
140
 
141
141
  def find_options_for_find_tagged_with(tags, options = {})
142
- tags = TagList.from(tags)
142
+ tag_list = TagList.from(tags)
143
143
 
144
- return {} if tags.empty?
144
+ return {} if tag_list.empty?
145
145
 
146
146
  joins = []
147
147
  conditions = []
@@ -150,11 +150,12 @@ module ActiveRecord
150
150
 
151
151
 
152
152
  if options.delete(:exclude)
153
- tags_conditions = tags.map { |t| sanitize_sql(["#{Tag.table_name}.name LIKE ?", t]) }.join(" OR ")
153
+ tags_conditions = tag_list.map { |t| sanitize_sql(["#{Tag.table_name}.name LIKE ?", t]) }.join(" OR ")
154
154
  conditions << "#{table_name}.#{primary_key} NOT IN (SELECT #{Tagging.table_name}.taggable_id FROM #{Tagging.table_name} JOIN #{Tag.table_name} ON #{Tagging.table_name}.tag_id = #{Tag.table_name}.id AND (#{tags_conditions}) WHERE #{Tagging.table_name}.taggable_type = #{quote_value(base_class.name)})"
155
155
 
156
156
  else
157
- tags = Tag.named_like_any(tags)
157
+ tags = Tag.named_like_any(tag_list)
158
+ return { :conditions => "1 = 0" } unless tags.length == tag_list.length
158
159
 
159
160
  tags.each do |tag|
160
161
  safe_tag = tag.name.gsub(/[^a-zA-Z0-9]/, '')
@@ -77,6 +77,8 @@ describe "Taggable" do
77
77
  @taggable.save
78
78
 
79
79
  TaggableModel.tagged_with("ruby").first.should == @taggable
80
+ TaggableModel.tagged_with("ruby, css").first.should == @taggable
81
+ TaggableModel.tagged_with("ruby, nonexistingtag").should be_empty
80
82
  TaggableModel.tagged_with("bob", :on => :skills).first.should_not == @taggable
81
83
  TaggableModel.tagged_with("bob", :on => :tags).first.should == @taggable
82
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-taggable-on
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-17 00:00:00 +01:00
12
+ date: 2009-12-18 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15