diff --git a/Gemfile b/Gemfile index 53cd8e390..cc6407afb 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'gds-api-adapters', '7.14.0' gem 'mlanett-redis-lock', '0.2.2' gem 'whenever', '0.8.4' gem 'gretel', '3.0.5' -gem 'acts-as-taggable-on', '3.0.1' +gem 'acts-as-taggable-on', '3.1.1' gem 'select2-rails', '3.5.2' # We use Errbit for tracking exceptions, which needs the airbrake gem. Config diff --git a/Gemfile.lock b/Gemfile.lock index a844981b7..446b8dc33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,8 +29,10 @@ GEM activesupport (3.2.17) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - acts-as-taggable-on (3.0.1) - rails (>= 3, < 5) + acts-as-taggable-on (3.1.1) + actionpack (>= 3, < 5) + activerecord (>= 3, < 5) + activesupport (>= 3, < 5) addressable (2.3.5) airbrake (3.1.15) builder @@ -137,7 +139,7 @@ GEM mini_portile (0.5.1) mlanett-redis-lock (0.2.2) redis - multi_json (1.8.4) + multi_json (1.9.3) multi_xml (0.5.5) multipart-post (1.2.0) mysql2 (0.3.13) @@ -181,7 +183,7 @@ GEM rack (>= 0.4) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.3) + rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) @@ -201,7 +203,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.1.1) + rake (10.3.1) rdoc (3.12.2) json (~> 1.4) redis (3.0.4) @@ -237,13 +239,13 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - thor (0.18.1) + thor (0.19.1) tilt (1.4.1) timecop (0.5.9.2) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.38) + tzinfo (0.3.39) uglifier (2.0.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -268,7 +270,7 @@ PLATFORMS ruby DEPENDENCIES - acts-as-taggable-on (= 3.0.1) + acts-as-taggable-on (= 3.1.1) airbrake (= 3.1.15) bootstrap-sass (= 3.1.0) capybara (= 2.1.0) diff --git a/db/migrate/20140502114341_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20140502114341_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..d0dab1683 --- /dev/null +++ b/db/migrate/20140502114341_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/structure.sql b/db/structure.sql index 748f24c05..67628cdb9 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -175,6 +175,7 @@ CREATE TABLE `taggings` ( CREATE TABLE `tags` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `taggings_count` int(11) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `index_tags_on_name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -284,3 +285,5 @@ INSERT INTO schema_migrations (version) VALUES ('20140331115315'); INSERT INTO schema_migrations (version) VALUES ('20140331121029'); INSERT INTO schema_migrations (version) VALUES ('20140404112839'); + +INSERT INTO schema_migrations (version) VALUES ('20140502114341'); diff --git a/spec/models/mapping_spec.rb b/spec/models/mapping_spec.rb index 7151a2cf4..704cacae2 100644 --- a/spec/models/mapping_spec.rb +++ b/spec/models/mapping_spec.rb @@ -234,14 +234,6 @@ ['/path-3', 40 * 3 + 30 * 3] ] end - - it 'plays nicely with tagging' do - m = Mapping.first - m.tag_list = ['foo'] - m.save! - - expect { @mappings.tagged_with('foo').any? }.to_not raise_error - end end end