Skip to content
Extraits de code Groupes Projets
Valider 72d1ed8f rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

bump acts-as-taggable-on

parent b20712e1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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)
......
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
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
require 'models/acts_as_taggable_on/tag'
require 'models/acts_as_taggable_on-tag'
ActsAsTaggableOn.force_lowercase = true
# 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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter