di-acts-as-taggable 1.0 → 1.0.1

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.10
1
+ 1.0.1
@@ -130,7 +130,7 @@ module ActiveRecord
130
130
  end
131
131
 
132
132
  def all_tag_counts(options = {})
133
- Tag.find(:all, find_options_for_tag_counts(options))
133
+ Tag.find(:all, find_options_for_tag_counts(options))
134
134
  end
135
135
 
136
136
  def find_options_for_find_tagged_with(tags, options = {})
@@ -145,7 +145,7 @@ module ActiveRecord
145
145
 
146
146
 
147
147
  if options.delete(:exclude)
148
- tags_conditions = tags.map { |t| sanitize_sql(["#{Tag.table_name}.name LIKE ?", t]) }.join(" OR ")
148
+ tags_conditions = tags.map { |t| sanitize_sql(["#{Tag.table_name}.name = ?", t]) }.join(" OR ")
149
149
  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)})"
150
150
 
151
151
  else
@@ -232,8 +232,7 @@ module ActiveRecord
232
232
  at_least = sanitize_sql(['COUNT(*) >= ?', options.delete(:at_least)]) if options[:at_least]
233
233
  at_most = sanitize_sql(['COUNT(*) <= ?', options.delete(:at_most)]) if options[:at_most]
234
234
  having = [at_least, at_most].compact.join(' AND ')
235
- group_by = "#{Tag.table_name}.id HAVING COUNT(*) > 0"
236
- group_by << " AND #{having}" unless having.blank?
235
+ group_by = "#{Tag.table_name}.id"
237
236
 
238
237
  { :select => "#{Tag.table_name}.*, COUNT(*) AS count",
239
238
  :joins => joins.join(" "),
@@ -3,10 +3,10 @@ class Tag < ActiveRecord::Base
3
3
 
4
4
  validates_presence_of :name
5
5
  validates_uniqueness_of :name
6
-
7
- # LIKE is used for cross-database case-insensitivity
6
+
8
7
  def self.find_or_create_with_like_by_name(name)
9
- find(:first, :conditions => ["name LIKE ?", name]) || create(:name => name)
8
+ name = name.mb_chars.downcase.strip.normalize
9
+ find(:first, :conditions => ["name = ?", name]) || create(:name => name)
10
10
  end
11
11
 
12
12
  def ==(object)
@@ -20,4 +20,5 @@ class Tag < ActiveRecord::Base
20
20
  def count
21
21
  read_attribute(:count).to_i
22
22
  end
23
+
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: di-acts-as-taggable
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dieinzige
@@ -47,7 +47,7 @@ files:
47
47
  - spec/spec.opts
48
48
  - spec/spec_helper.rb
49
49
  has_rdoc: true
50
- homepage: http://github.com/mbleigh/acts-as-taggable-on
50
+ homepage: http://github.com/dieinzige/acts-as-taggable-on
51
51
  licenses: []
52
52
 
53
53
  post_install_message: