Merge pull request #4978 from jhass/bump_acts_as_taggable_on

Bump acts-as-taggable-on
This commit is contained in:
Jonne Haß 2014-08-18 12:20:19 +02:00
commit ec877e3784
7 changed files with 46 additions and 28 deletions

View file

@ -89,7 +89,7 @@ gem 'omniauth-wordpress','0.2.1'
# Tags
gem 'acts-as-taggable-on', '2.4.1'
gem 'acts-as-taggable-on', '3.2.6'
# URIs and HTTP

View file

@ -30,8 +30,8 @@ GEM
activesupport (3.2.19)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
acts-as-taggable-on (3.2.6)
activerecord (>= 3, < 5)
acts_as_api (0.4.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
@ -470,7 +470,7 @@ PLATFORMS
DEPENDENCIES
activerecord-import (= 0.3.1)
acts-as-taggable-on (= 2.4.1)
acts-as-taggable-on (= 3.2.6)
acts_as_api (= 0.4.2)
addressable (= 2.3.6)
asset_sync (= 1.0.0)

View file

@ -0,0 +1,23 @@
module ActsAsTaggableOn
class Tag
self.include_root_in_json = false
def self.tag_text_regexp
@@tag_text_regexp ||= "[[:alnum:]]_-"
end
def self.autocomplete(name)
where("name LIKE ?", "#{name.downcase}%")
end
def self.normalize(name)
if name =~ /^#?<3/
# Special case for love, because the world needs more love.
'<3'
elsif name
name.gsub(/[^#{self.tag_text_regexp}]/, '').downcase
end
end
end
end

View file

@ -1,21 +0,0 @@
class ActsAsTaggableOn::Tag
self.include_root_in_json = false
def self.tag_text_regexp
@@tag_text_regexp ||= "[[:alnum:]]_-"
end
def self.autocomplete(name)
where("name LIKE ?", "#{name.downcase}%")
end
def self.normalize(name)
if name =~ /^#?<3/
# Special case for love, because the world needs more love.
'<3'
elsif name
name.gsub(/[^#{self.tag_text_regexp}]/, '').downcase
end
end
end

View file

@ -1,2 +1,2 @@
require 'models/acts_as_taggable_on/tag'
require 'models/acts_as_taggable_on-tag'
ActsAsTaggableOn.force_lowercase = true

View file

@ -0,0 +1,15 @@
# This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
def self.up
add_column :tags, :taggings_count, :integer, default: 0
ActsAsTaggableOn::Tag.reset_column_information
ActsAsTaggableOn::Tag.find_each do |tag|
ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
end
end
def self.down
remove_column :tags, :taggings_count
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140422134627) do
ActiveRecord::Schema.define(:version => 20140601102543) do
create_table "account_deletions", :force => true do |t|
t.string "diaspora_handle"
@ -482,7 +482,8 @@ ActiveRecord::Schema.define(:version => 20140422134627) do
add_index "taggings", ["taggable_id", "taggable_type", "tag_id"], :name => "index_taggings_uniquely", :unique => true
create_table "tags", :force => true do |t|
t.string "name"
t.string "name"
t.integer "taggings_count", :default => 0
end
add_index "tags", ["name"], :name => "index_tags_on_name", :unique => true