acts-as-taggable-on 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/acts_as_taggable_on/acts_as_taggable_on.rb +15 -11
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
@@ -158,7 +158,7 @@ module ActiveRecord
|
|
158
158
|
conditions << "#{table_name}.#{primary_key} 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)})"
|
159
159
|
|
160
160
|
else
|
161
|
-
tags = Tag.
|
161
|
+
tags = Tag.named_any(tag_list)
|
162
162
|
return { :conditions => "1 = 0" } unless tags.length == tag_list.length
|
163
163
|
|
164
164
|
tags.each do |tag|
|
@@ -380,11 +380,11 @@ module ActiveRecord
|
|
380
380
|
:order => "count DESC"
|
381
381
|
}.update(options)
|
382
382
|
end
|
383
|
-
|
383
|
+
|
384
384
|
def save_cached_tag_list
|
385
385
|
self.class.tag_types.map(&:to_s).each do |tag_type|
|
386
|
-
if self.class.send("caching_#{tag_type.singularize}_list?")
|
387
|
-
self["cached_#{tag_type.singularize}_list"] = tag_list_cache_on(tag_type.singularize).
|
386
|
+
if self.class.send("caching_#{tag_type.singularize}_list?")
|
387
|
+
self["cached_#{tag_type.singularize}_list"] = tag_list_cache_on(tag_type.singularize).to_a.flatten.compact.join(', ')
|
388
388
|
end
|
389
389
|
end
|
390
390
|
end
|
@@ -403,17 +403,21 @@ module ActiveRecord
|
|
403
403
|
# Destroy old taggings:
|
404
404
|
if owner
|
405
405
|
old_tags = tags_on(context, owner) - new_tags
|
406
|
-
old_taggings = Tagging.find(:all, :conditions => { :taggable_id => self.id, :taggable_type => self.class.to_s, :tag_id => old_tags, :tagger_id => owner, :tagger_type => owner.class.to_s, :context => context })
|
406
|
+
old_taggings = Tagging.find(:all, :conditions => { :taggable_id => self.id, :taggable_type => self.class.to_s, :tag_id => old_tags, :tagger_id => owner.id, :tagger_type => owner.class.to_s, :context => context })
|
407
407
|
|
408
|
-
old_taggings.
|
409
|
-
else
|
408
|
+
Tagging.destroy_all :id => old_taggings.map(&:id)
|
409
|
+
else
|
410
410
|
old_tags = tags_on(context) - new_tags
|
411
411
|
base_tags.delete(*old_tags)
|
412
412
|
end
|
413
|
-
|
414
|
-
new_tags.reject! { |tag| taggings.any? { |tagging|
|
415
|
-
|
416
|
-
|
413
|
+
|
414
|
+
new_tags.reject! { |tag| taggings.any? { |tagging|
|
415
|
+
tagging.tag_id == tag.id &&
|
416
|
+
tagging.tagger_id == (owner ? owner.id : nil) &&
|
417
|
+
tagging.tagger_type == (owner ? owner.class.to_s : nil) &&
|
418
|
+
tagging.context == context
|
419
|
+
}
|
420
|
+
}
|
417
421
|
|
418
422
|
# create new taggings:
|
419
423
|
new_tags.each do |tag|
|
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.1.
|
4
|
+
version: 1.1.4
|
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: 2010-02-
|
12
|
+
date: 2010-02-13 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|