diff --git a/Gemfile b/Gemfile index a696f40..a504149 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" gem 'rails', '~> 3.2.21' gem 'minitest', '~> 3.2.0' gem 'fast_gettext', '~> 0.6.8' -gem 'acts-as-taggable-on', '~> 3.0.2' +gem 'acts-as-taggable-on', '~> 3.4.2' gem 'rails_autolink', '~> 1.1.5' gem 'pg', '~> 0.13.2' gem 'rmagick', '~> 2.13.1' diff --git a/db/migrate/20150116181243_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150116181243_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..8edb508 --- /dev/null +++ b/db/migrate/20150116181243_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -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 diff --git a/db/migrate/20150116181244_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150116181244_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..71f2d7f --- /dev/null +++ b/db/migrate/20150116181244_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from acts_as_taggable_on_engine (originally 4) +class AddMissingTaggableIndex < ActiveRecord::Migration + def self.up + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def self.down + remove_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index f7c5be5..96230ce 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 require_relative "../test_helper" class ArticleTest < ActiveSupport::TestCase @@ -770,6 +771,13 @@ class ArticleTest < ActiveSupport::TestCase assert_includes as, a end + should 'get tagged with tag that contains special chars' do + a = create(Article, :name => 'Published at', :profile_id => profile.id, :tag_list => 'Métodos Ágeis') + as = Article.tagged_with('Métodos Ágeis') + + assert_includes as, a + end + should 'not get tagged with tag from other environment' do article_from_this_environment = create(Article, :profile => profile, :tag_list => 'bli') -- libgit2 0.21.2