From 61dc69cc5d8089ed9f96bc65dc64de6e075f70cf Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 24 Jun 2026 16:16:57 +0200 Subject: 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 --- Gemfile | 4 +-- Gemfile.lock | 8 +++--- bin/rails | 29 ++++++++++++++++++++ config.ru | 4 +++ config/application.rb | 1 + config/environments/development.rb | 1 + ...able_on_migration.acts_as_taggable_on_engine.rb | 31 ++++++++++++++++++++++ ...ng_unique_indices.acts_as_taggable_on_engine.rb | 20 ++++++++++++++ ...ter_cache_to_tags.acts_as_taggable_on_engine.rb | 15 +++++++++++ ...ng_taggable_index.acts_as_taggable_on_engine.rb | 10 +++++++ ...ion_for_tag_names.acts_as_taggable_on_engine.rb | 10 +++++++ 11 files changed, 127 insertions(+), 6 deletions(-) create mode 100755 bin/rails create mode 100644 config.ru create mode 100644 db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb diff --git a/Gemfile b/Gemfile index 9a803c9..594f94e 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem 'rails', '3.2.22.5' gem 'pg', '~> 0.17.0' # from your vendor/plugins, now as gems: -gem 'acts-as-taggable-on', '~> 2.4' +gem 'acts-as-taggable-on', '~> 3.5' gem 'awesome_nested_set', '~> 2.1' gem 'acts_as_list' gem 'globalize3', '~> 0.3.0' @@ -25,7 +25,7 @@ group :assets do end group :test do - gem 'test-unit', '~> 3.0' + gem 'test-unit', '~> 3.5' end 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 activesupport (3.2.22.5) 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.5.0) + activerecord (>= 3.2, < 5) acts_as_list (0.9.19) activerecord (>= 3.0) arel (3.0.3) @@ -148,7 +148,7 @@ PLATFORMS ruby DEPENDENCIES - acts-as-taggable-on (~> 2.4) + acts-as-taggable-on (~> 3.5) acts_as_list awesome_nested_set (~> 2.1) chaos_calendar! @@ -161,7 +161,7 @@ DEPENDENCIES rails (= 3.2.22.5) routing-filter (~> 0.3) sass-rails (~> 3.2.3) - test-unit (~> 3.0) + test-unit (~> 3.5) uglifier (>= 1.0.3) unicorn (~> 1.1) 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 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rails' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +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 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +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 config.i18n.default_locale = :de config.filter_parameters += [:password, :password_confirmation] + config.serve_static_assets = true end 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 config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log + config.serve_static_assets = true 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 @@ +# This migration comes from acts_as_taggable_on_engine (originally 1) +class ActsAsTaggableOnMigration < ActiveRecord::Migration + def self.up + create_table :tags do |t| + t.string :name + end + + create_table :taggings do |t| + t.references :tag + + # You should make sure that the column created is + # long enough to store the required class names. + t.references :taggable, polymorphic: true + t.references :tagger, polymorphic: true + + # Limit is created to prevent MySQL error on index + # length for MyISAM table type: http://bit.ly/vgW2Ql + t.string :context, limit: 128 + + t.datetime :created_at + end + + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def self.down + drop_table :taggings + drop_table :tags + end +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 @@ +# This migration comes from acts_as_taggable_on_engine (originally 2) +class AddMissingUniqueIndices < ActiveRecord::Migration + def self.up + add_index :tags, :name, unique: true + + remove_index :taggings, :tag_id + remove_index :taggings, [:taggable_id, :taggable_type, :context] + add_index :taggings, + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: 'taggings_idx' + end + + def self.down + remove_index :tags, :name + + remove_index :taggings, name: 'taggings_idx' + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end +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 @@ +# 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/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 @@ +# 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/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 @@ +# This migration comes from acts_as_taggable_on_engine (originally 5) +# This migration is added to circumvent issue #623 and have special characters +# work properly +class ChangeCollationForTagNames < ActiveRecord::Migration + def up + if ActsAsTaggableOn::Utils.using_mysql? + execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") + end + end +end -- cgit v1.3