diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-24 16:16:57 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-24 16:16:57 +0200 |
| commit | 61dc69cc5d8089ed9f96bc65dc64de6e075f70cf (patch) | |
| tree | 2a25126657acc65a010d1f11a2a2208f38bf41a1 | |
| parent | e0a7e0fec760ba12c8067a37e10c96f1f05876e2 (diff) | |
Upgrade acts-as-taggable-on to 3.5, add Rails 3.2 config fixes
- Bump acts-as-taggable-on from 2.4.1 to 3.5.0
- Fake engine migrations for pre-existing schema
- Set serve_static_assets in development
- Fix request.fullpath in authenticated_system (request_uri removed in Rails 3.x)
- Fix Paperclip path format to match existing file layout
| -rw-r--r-- | Gemfile | 4 | ||||
| -rw-r--r-- | Gemfile.lock | 8 | ||||
| -rwxr-xr-x | bin/rails | 29 | ||||
| -rw-r--r-- | config.ru | 4 | ||||
| -rw-r--r-- | config/application.rb | 1 | ||||
| -rw-r--r-- | config/environments/development.rb | 1 | ||||
| -rw-r--r-- | db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 31 | ||||
| -rw-r--r-- | db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 20 | ||||
| -rw-r--r-- | db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 15 | ||||
| -rw-r--r-- | db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 10 | ||||
| -rw-r--r-- | db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 10 |
11 files changed, 127 insertions, 6 deletions
| @@ -5,7 +5,7 @@ gem 'rails', '3.2.22.5' | |||
| 5 | gem 'pg', '~> 0.17.0' | 5 | gem 'pg', '~> 0.17.0' |
| 6 | 6 | ||
| 7 | # from your vendor/plugins, now as gems: | 7 | # from your vendor/plugins, now as gems: |
| 8 | gem 'acts-as-taggable-on', '~> 2.4' | 8 | gem 'acts-as-taggable-on', '~> 3.5' |
| 9 | gem 'awesome_nested_set', '~> 2.1' | 9 | gem 'awesome_nested_set', '~> 2.1' |
| 10 | gem 'acts_as_list' | 10 | gem 'acts_as_list' |
| 11 | gem 'globalize3', '~> 0.3.0' | 11 | gem 'globalize3', '~> 0.3.0' |
| @@ -25,7 +25,7 @@ group :assets do | |||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | group :test do | 27 | group :test do |
| 28 | gem 'test-unit', '~> 3.0' | 28 | gem 'test-unit', '~> 3.5' |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | gem 'chaos_calendar', :git => 'https://github.com/erdgeist/chaoscalendar.git', :require => 'chaos_calendar', :branch => 'erdgeist-ruby1.9' | 31 | gem 'chaos_calendar', :git => 'https://github.com/erdgeist/chaoscalendar.git', :require => 'chaos_calendar', :branch => 'erdgeist-ruby1.9' |
diff --git a/Gemfile.lock b/Gemfile.lock index 84425ea..34e0133 100644 --- a/Gemfile.lock +++ b/Gemfile.lock | |||
| @@ -35,8 +35,8 @@ GEM | |||
| 35 | activesupport (3.2.22.5) | 35 | activesupport (3.2.22.5) |
| 36 | i18n (~> 0.6, >= 0.6.4) | 36 | i18n (~> 0.6, >= 0.6.4) |
| 37 | multi_json (~> 1.0) | 37 | multi_json (~> 1.0) |
| 38 | acts-as-taggable-on (2.4.1) | 38 | acts-as-taggable-on (3.5.0) |
| 39 | rails (>= 3, < 5) | 39 | activerecord (>= 3.2, < 5) |
| 40 | acts_as_list (0.9.19) | 40 | acts_as_list (0.9.19) |
| 41 | activerecord (>= 3.0) | 41 | activerecord (>= 3.0) |
| 42 | arel (3.0.3) | 42 | arel (3.0.3) |
| @@ -148,7 +148,7 @@ PLATFORMS | |||
| 148 | ruby | 148 | ruby |
| 149 | 149 | ||
| 150 | DEPENDENCIES | 150 | DEPENDENCIES |
| 151 | acts-as-taggable-on (~> 2.4) | 151 | acts-as-taggable-on (~> 3.5) |
| 152 | acts_as_list | 152 | acts_as_list |
| 153 | awesome_nested_set (~> 2.1) | 153 | awesome_nested_set (~> 2.1) |
| 154 | chaos_calendar! | 154 | chaos_calendar! |
| @@ -161,7 +161,7 @@ DEPENDENCIES | |||
| 161 | rails (= 3.2.22.5) | 161 | rails (= 3.2.22.5) |
| 162 | routing-filter (~> 0.3) | 162 | routing-filter (~> 0.3) |
| 163 | sass-rails (~> 3.2.3) | 163 | sass-rails (~> 3.2.3) |
| 164 | test-unit (~> 3.0) | 164 | test-unit (~> 3.5) |
| 165 | uglifier (>= 1.0.3) | 165 | uglifier (>= 1.0.3) |
| 166 | unicorn (~> 1.1) | 166 | unicorn (~> 1.1) |
| 167 | will_paginate (~> 3.0) | 167 | will_paginate (~> 3.0) |
diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..7fd59cc --- /dev/null +++ b/bin/rails | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #!/usr/bin/env ruby | ||
| 2 | # frozen_string_literal: true | ||
| 3 | |||
| 4 | # | ||
| 5 | # This file was generated by Bundler. | ||
| 6 | # | ||
| 7 | # The application 'rails' is installed as part of a gem, and | ||
| 8 | # this file is here to facilitate running it. | ||
| 9 | # | ||
| 10 | |||
| 11 | require "pathname" | ||
| 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", | ||
| 13 | Pathname.new(__FILE__).realpath) | ||
| 14 | |||
| 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) | ||
| 16 | |||
| 17 | if File.file?(bundle_binstub) | ||
| 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ | ||
| 19 | load(bundle_binstub) | ||
| 20 | else | ||
| 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. | ||
| 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 26 | require "rubygems" | ||
| 27 | require "bundler/setup" | ||
| 28 | |||
| 29 | load Gem.bin_path("railties", "rails") | ||
diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..64c7ad9 --- /dev/null +++ b/config.ru | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | # This file is used by Rack-based servers to start the application. | ||
| 2 | |||
| 3 | require ::File.expand_path('../config/environment', __FILE__) | ||
| 4 | run Cccms::Application | ||
diff --git a/config/application.rb b/config/application.rb index 9b7ae67..cb92166 100644 --- a/config/application.rb +++ b/config/application.rb | |||
| @@ -56,5 +56,6 @@ module Cccms | |||
| 56 | config.i18n.default_locale = :de | 56 | config.i18n.default_locale = :de |
| 57 | 57 | ||
| 58 | config.filter_parameters += [:password, :password_confirmation] | 58 | config.filter_parameters += [:password, :password_confirmation] |
| 59 | config.serve_static_assets = true | ||
| 59 | end | 60 | end |
| 60 | end | 61 | end |
diff --git a/config/environments/development.rb b/config/environments/development.rb index 6446686..94f216f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb | |||
| @@ -17,4 +17,5 @@ Cccms::Application.configure do | |||
| 17 | config.action_mailer.raise_delivery_errors = false | 17 | config.action_mailer.raise_delivery_errors = false |
| 18 | 18 | ||
| 19 | config.active_support.deprecation = :log | 19 | config.active_support.deprecation = :log |
| 20 | config.serve_static_assets = true | ||
| 20 | end | 21 | end |
diff --git a/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..6bbd559 --- /dev/null +++ b/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 1) | ||
| 2 | class ActsAsTaggableOnMigration < ActiveRecord::Migration | ||
| 3 | def self.up | ||
| 4 | create_table :tags do |t| | ||
| 5 | t.string :name | ||
| 6 | end | ||
| 7 | |||
| 8 | create_table :taggings do |t| | ||
| 9 | t.references :tag | ||
| 10 | |||
| 11 | # You should make sure that the column created is | ||
| 12 | # long enough to store the required class names. | ||
| 13 | t.references :taggable, polymorphic: true | ||
| 14 | t.references :tagger, polymorphic: true | ||
| 15 | |||
| 16 | # Limit is created to prevent MySQL error on index | ||
| 17 | # length for MyISAM table type: http://bit.ly/vgW2Ql | ||
| 18 | t.string :context, limit: 128 | ||
| 19 | |||
| 20 | t.datetime :created_at | ||
| 21 | end | ||
| 22 | |||
| 23 | add_index :taggings, :tag_id | ||
| 24 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 25 | end | ||
| 26 | |||
| 27 | def self.down | ||
| 28 | drop_table :taggings | ||
| 29 | drop_table :tags | ||
| 30 | end | ||
| 31 | end | ||
diff --git a/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..4ca676f --- /dev/null +++ b/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 2) | ||
| 2 | class AddMissingUniqueIndices < ActiveRecord::Migration | ||
| 3 | def self.up | ||
| 4 | add_index :tags, :name, unique: true | ||
| 5 | |||
| 6 | remove_index :taggings, :tag_id | ||
| 7 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 8 | add_index :taggings, | ||
| 9 | [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], | ||
| 10 | unique: true, name: 'taggings_idx' | ||
| 11 | end | ||
| 12 | |||
| 13 | def self.down | ||
| 14 | remove_index :tags, :name | ||
| 15 | |||
| 16 | remove_index :taggings, name: 'taggings_idx' | ||
| 17 | add_index :taggings, :tag_id | ||
| 18 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 19 | end | ||
| 20 | end | ||
diff --git a/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..8edb508 --- /dev/null +++ b/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 3) | ||
| 2 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration | ||
| 3 | def self.up | ||
| 4 | add_column :tags, :taggings_count, :integer, default: 0 | ||
| 5 | |||
| 6 | ActsAsTaggableOn::Tag.reset_column_information | ||
| 7 | ActsAsTaggableOn::Tag.find_each do |tag| | ||
| 8 | ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) | ||
| 9 | end | ||
| 10 | end | ||
| 11 | |||
| 12 | def self.down | ||
| 13 | remove_column :tags, :taggings_count | ||
| 14 | end | ||
| 15 | end | ||
diff --git a/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..71f2d7f --- /dev/null +++ b/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 4) | ||
| 2 | class AddMissingTaggableIndex < ActiveRecord::Migration | ||
| 3 | def self.up | ||
| 4 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 5 | end | ||
| 6 | |||
| 7 | def self.down | ||
| 8 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 9 | end | ||
| 10 | end | ||
diff --git a/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..bfb06bc --- /dev/null +++ b/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 5) | ||
| 2 | # This migration is added to circumvent issue #623 and have special characters | ||
| 3 | # work properly | ||
| 4 | class ChangeCollationForTagNames < ActiveRecord::Migration | ||
| 5 | def up | ||
| 6 | if ActsAsTaggableOn::Utils.using_mysql? | ||
| 7 | execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") | ||
| 8 | end | ||
| 9 | end | ||
| 10 | end | ||
