bump acts-as-taggable-on
This commit is contained in:
parent
b20712e1ad
commit
72d1ed8f7d
7 changed files with 46 additions and 28 deletions
2
Gemfile
2
Gemfile
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ GEM
|
|||
activesupport (3.2.18)
|
||||
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)
|
||||
|
|
|
|||
23
app/models/acts_as_taggable_on-tag.rb
Normal file
23
app/models/acts_as_taggable_on-tag.rb
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
require 'models/acts_as_taggable_on/tag'
|
||||
require 'models/acts_as_taggable_on-tag'
|
||||
ActsAsTaggableOn.force_lowercase = true
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue