Skip to content

Commit

Permalink
Update acts-as-taggable-on from 3.0.1 to 3.1.1
Browse files Browse the repository at this point in the history
* This fixes the issue where the Mapping.with_traffic_summary scope
  would not chain with Mapping.tagged_with, generating invalid SQL when
  a `count` was required (falling over on `any?` and the like)
* While we initially patched AATO ourselves, it turns out a fix was
  already merged for AATO 3.1.0
  (mbleigh/acts-as-taggable-on#417)
* 3.1.1 also had a tag counting performance improvement, which in
  truth doesn't do much for us but requires a migration
  • Loading branch information
rgarner authored and jennyd committed May 6, 2014
1 parent 09aceb5 commit e58217d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gem 'gds-api-adapters', '7.14.0'
gem 'mlanett-redis-lock', '0.2.6'
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'
gem 'activerecord-import', '0.5.0'
gem 'sidekiq', '3.0.0'
Expand Down
18 changes: 10 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,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
Expand Down Expand Up @@ -142,7 +144,7 @@ GEM
mini_portile (0.5.1)
mlanett-redis-lock (0.2.6)
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)
Expand Down Expand Up @@ -186,7 +188,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)
Expand All @@ -206,7 +208,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.7)
Expand Down Expand Up @@ -250,14 +252,14 @@ 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)
timers (1.1.0)
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)
Expand All @@ -283,7 +285,7 @@ PLATFORMS

DEPENDENCIES
activerecord-import (= 0.5.0)
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ CREATE TABLE `organisations_sites` (
`site_id` int(11) NOT NULL,
`organisation_id` int(11) NOT NULL,
UNIQUE KEY `index_organisations_sites_on_site_id_and_organisation_id` (`site_id`,`organisation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `schema_migrations` (
`version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
Expand All @@ -164,7 +164,7 @@ CREATE TABLE `sessions` (
PRIMARY KEY (`id`),
KEY `index_sessions_on_session_id` (`session_id`),
KEY `index_sessions_on_updated_at` (`updated_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `sites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
Expand Down Expand Up @@ -201,6 +201,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;
Expand Down Expand Up @@ -316,3 +317,5 @@ INSERT INTO schema_migrations (version) VALUES ('20140417100412');
INSERT INTO schema_migrations (version) VALUES ('20140422160500');

INSERT INTO schema_migrations (version) VALUES ('20140422184036');

INSERT INTO schema_migrations (version) VALUES ('20140502114341');
8 changes: 0 additions & 8 deletions spec/models/mapping_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,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

Expand Down

0 comments on commit e58217d

Please sign in to comment.