From e0a7e0fec760ba12c8067a37e10c96f1f05876e2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 24 Jun 2026 04:13:16 +0200 Subject: Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade - Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs --- config/application.rb | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 config/application.rb (limited to 'config/application.rb') diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..9b7ae67 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,60 @@ +# Put this in config/application.rb +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +Bundler.require(:default, Rails.env) if defined?(Bundler) + +require 'action_controller' + +module ActionController + class Base + def self.consider_all_requests_local=(val) + # no-op: controlled via config.consider_all_requests_local in environment files + end + end +end + +module Cccms + class Application < Rails::Application + config.autoload_paths += [config.root.join('lib')] + config.encoding = 'utf-8' + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Add additional load paths for your own custom dirs + # config.load_paths += %W( #{RAILS_ROOT}/extras ) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Allowed Tags + # strong em b i p code pre tt samp kbd var sub sup dfn cite big small + # address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dt dd abbr + # acronym a img blockquote del ins + + # Allowed Attributes: + # href src width height alt cite datetime title class name xml:lang abbr)) + + # Add tags to whitelist with: + # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td' + + # Add attributes to whitelist with: + # config.action_view.sanitized_allowed_attributes = 'id', 'class', 'style' + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. + config.time_zone = 'Berlin' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] + config.i18n.default_locale = :de + + config.filter_parameters += [:password, :password_confirmation] + end +end -- cgit v1.3 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 (limited to 'config/application.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 From 3f236c7a0e544db94ef822f120d649ac5ee958f7 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 25 Jun 2026 04:34:24 +0200 Subject: Upgrade to Rails 4.2.11.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump rails 3.2.22.5 → 4.2.11.3 - Replace globalize3 with globalize ~> 5.0 (gem renamed at 5.0) - Upgrade routing-filter ~> 0.3 → ~> 0.6 - Upgrade sass-rails, coffee-rails to 4.x - Upgrade awesome_nested_set 2.x → 3.x (Rails 4 required) - Add jquery-rails for UJS support - Pin nokogiri ~> 1.10.10, loofah ~> 2.20.0, rails-html-sanitizer ~> 1.4.4 - Add config/secrets.yml (gitignored), eager_load, serve_static_files - Fix routes: add via: to all match calls, remove legacy catch-all routes - Add admin named route, fix rvm dotfiles - Fix ActiveRecord::FixtureSet rename in test_helper - Set active_support.test_order and active_record.raise_in_transactional_callbacks --- .gitignore | 6 +- .ruby-gemset | 1 + .ruby-version | 1 + Gemfile | 23 ++-- Gemfile.lock | 221 +++++++++++++++++++++---------------- bin/bundle | 3 + bin/rails | 31 +----- bin/rake | 4 + bin/setup | 29 +++++ config/application.rb | 2 +- config/environments/development.rb | 3 +- config/environments/production.rb | 1 + config/environments/test.rb | 25 ++--- config/routes.rb | 20 ++-- test/test_helper.rb | 2 +- 15 files changed, 204 insertions(+), 168 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version create mode 100755 bin/bundle create mode 100755 bin/rake create mode 100755 bin/setup (limited to 'config/application.rb') diff --git a/.gitignore b/.gitignore index 26b8198..834939f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,8 @@ public/system vendor/plugins/paperclip/tmp db/sphinx config/*.sphinx.conf -tmp \ No newline at end of file +tmpconfig/database.yml +config/database.yml +config/initializers/secret_token.rb +tmp/ +config/secrets.yml diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..c100f88 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +rails3-upgrade diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..5304f06 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.4.10 diff --git a/Gemfile b/Gemfile index 594f94e..f00395b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,26 +1,29 @@ source 'https://rubygems.org' -gem 'rails', '3.2.22.5' +gem 'rails', '4.2.11.3' gem 'pg', '~> 0.17.0' -# from your vendor/plugins, now as gems: gem 'acts-as-taggable-on', '~> 3.5' -gem 'awesome_nested_set', '~> 2.1' +gem 'awesome_nested_set', '~> 3.1' gem 'acts_as_list' -gem 'globalize3', '~> 0.3.0' -gem 'routing-filter', '~> 0.3' +gem 'globalize', '~> 5.0' +gem 'routing-filter', '~> 0.6' gem 'paperclip', '~> 3.5' gem 'will_paginate', '~> 3.0' gem 'exception_notification' gem 'libxml-ruby', :require => 'xml' -# gem 'thinking-sphinx', '1.5.0', :require => 'thinking_sphinx' +gem 'nokogiri', '~> 1.10.10' +gem 'loofah', '~> 2.20.0' +gem 'rails-html-sanitizer', '~> 1.4.4' +gem 'jquery-rails' + gem 'unicorn', '~> 1.1' group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' + gem 'sass-rails', '~> 4.0' + gem 'coffee-rails', '~> 4.0' gem 'uglifier', '>= 1.0.3' end @@ -28,5 +31,5 @@ group :test do gem 'test-unit', '~> 3.5' end -gem 'chaos_calendar', :git => 'https://github.com/erdgeist/chaoscalendar.git', :require => 'chaos_calendar', :branch => 'erdgeist-ruby1.9' - +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 34e0133..6350f67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,136 +8,157 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.22.5) - actionpack (= 3.2.22.5) - mail (~> 2.5.4) - actionpack (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) + actionmailer (4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.11.3) + actionview (= 4.2.11.3) + activesupport (= 4.2.11.3) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.11.3) + activesupport (= 4.2.11.3) + builder (~> 3.1) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) - activerecord (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - activesupport (3.2.22.5) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.11.3) + activesupport (= 4.2.11.3) + globalid (>= 0.3.0) + activemodel (4.2.11.3) + activesupport (= 4.2.11.3) + builder (~> 3.1) + activerecord (4.2.11.3) + activemodel (= 4.2.11.3) + activesupport (= 4.2.11.3) + arel (~> 6.0) + activesupport (4.2.11.3) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) acts-as-taggable-on (3.5.0) activerecord (>= 3.2, < 5) - acts_as_list (0.9.19) - activerecord (>= 3.0) - arel (3.0.3) - awesome_nested_set (2.1.6) - activerecord (>= 3.0.0) - builder (3.0.4) + acts_as_list (1.1.0) + activerecord (>= 4.2) + arel (6.0.4) + awesome_nested_set (3.9.0) + activerecord (>= 4.0.0, < 8.2) + builder (3.3.0) climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - coffee-rails (3.2.2) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (~> 3.2.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.3.7) + crass (1.0.6) erubis (2.7.0) - exception_notification (4.1.1) - actionmailer (>= 3.0.4) - activesupport (>= 3.0.4) + exception_notification (4.4.3) + actionmailer (>= 4.0, < 7) + activesupport (>= 4.0, < 7) execjs (2.9.0) - ffi (1.15.5) - globalize3 (0.3.1) - activemodel (>= 3.0.0) - activerecord (>= 3.0.0) - paper_trail (~> 2) + globalid (0.4.2) + activesupport (>= 4.2.0) + globalize (5.3.1) + activemodel (>= 4.2, < 6.1) + activerecord (>= 4.2, < 6.1) + request_store (~> 1.0) hike (1.2.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - journey (1.0.4) - json (1.8.6) + jquery-rails (4.6.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) libxml-ruby (3.1.0) - mail (2.5.5) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) + logger (1.5.3) + loofah (2.20.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + mime-types (3.7.0) + logger + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2026.0414) + mini_mime (1.1.2) + mini_portile2 (2.4.0) + minitest (5.15.0) multi_json (1.15.0) - paper_trail (2.7.2) - activerecord (~> 3.0) - railties (~> 3.0) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) paperclip (3.5.4) activemodel (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types pg (0.17.1) - polyglot (0.3.5) power_assert (3.0.1) - rack (1.4.7) - rack-cache (1.15.0) - rack (>= 0.4) - rack-ssl (1.3.4) - rack + rack (1.6.13) rack-test (0.6.3) rack (>= 1.0) - rails (3.2.22.5) - actionmailer (= 3.2.22.5) - actionpack (= 3.2.22.5) - activerecord (= 3.2.22.5) - activeresource (= 3.2.22.5) - activesupport (= 3.2.22.5) - bundler (~> 1.0) - railties (= 3.2.22.5) - railties (3.2.22.5) - actionpack (= 3.2.22.5) - activesupport (= 3.2.22.5) - rack-ssl (~> 1.3.2) + rails (4.2.11.3) + actionmailer (= 4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) + activemodel (= 4.2.11.3) + activerecord (= 4.2.11.3) + activesupport (= 4.2.11.3) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.11.3) + sprockets-rails + rails-deprecated_sanitizer (1.0.4) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) + railties (4.2.11.3) + actionpack (= 4.2.11.3) + activesupport (= 4.2.11.3) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) + thor (>= 0.18.1, < 2.0) rake (13.4.2) - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) - rdoc (3.12.2) - json (~> 1.4) - routing-filter (0.4.0.1) - actionpack (< 4.2) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.2.3) + request_store (1.7.0) + rack (>= 1.4) + routing-filter (0.6.3) + actionpack (>= 4.2) + activesupport (>= 4.2) + sass (3.2.19) + sass-rails (4.0.5) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) + sprockets (2.12.5) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) test-unit (3.7.8) power_assert thor (1.2.2) + thread_safe (0.3.6) tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.62) + tzinfo (1.2.11) + thread_safe (~> 0.1) uglifier (4.2.1) execjs (>= 0.3.0, < 3) unicorn (1.1.7) @@ -150,17 +171,21 @@ PLATFORMS DEPENDENCIES acts-as-taggable-on (~> 3.5) acts_as_list - awesome_nested_set (~> 2.1) + awesome_nested_set (~> 3.1) chaos_calendar! - coffee-rails (~> 3.2.1) + coffee-rails (~> 4.0) exception_notification - globalize3 (~> 0.3.0) + globalize (~> 5.0) + jquery-rails libxml-ruby + loofah (~> 2.20.0) + nokogiri (~> 1.10.10) paperclip (~> 3.5) pg (~> 0.17.0) - rails (= 3.2.22.5) - routing-filter (~> 0.3) - sass-rails (~> 3.2.3) + rails (= 4.2.11.3) + rails-html-sanitizer (~> 1.4.4) + routing-filter (~> 0.6) + sass-rails (~> 4.0) test-unit (~> 3.5) uglifier (>= 1.0.3) unicorn (~> 1.1) diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 7fd59cc..5191e69 100755 --- a/bin/rails +++ b/bin/rails @@ -1,29 +1,4 @@ #!/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") +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/config/application.rb b/config/application.rb index cb92166..1a7f32b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -56,6 +56,6 @@ module Cccms config.i18n.default_locale = :de config.filter_parameters += [:password, :password_confirmation] - config.serve_static_assets = true + config.serve_static_files = true end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 94f216f..3813cab 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -17,5 +17,6 @@ Cccms::Application.configure do config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log - config.serve_static_assets = true + config.serve_static_files = true + config.eager_load = false end diff --git a/config/environments/production.rb b/config/environments/production.rb index 2f933de..6f2c5bd 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,6 +13,7 @@ Cccms::Application.configure do config.log_level = :info config.active_support.deprecation = :notify + config.eager_load = false # Use a different logger for distributed setups # config.logger = SyslogLogger.new diff --git a/config/environments/test.rb b/config/environments/test.rb index 728e147..3b2413e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,32 +1,23 @@ -# Settings specified here will take precedence over those in config/environment.rb - Cccms::Application.configure do - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # config.whiny_nils = true # removed in Rails 4 - # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false - # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql + config.active_support.deprecation = :log + config.active_support.test_order = :sorted + + config.active_record.raise_in_transactional_callbacks = true - config.active_support.deprecation = :raise + config.eager_load = false + config.serve_static_files = true + config.static_cache_control = "public, max-age=3600" end diff --git a/config/routes.rb b/config/routes.rb index 5e3eb3f..4a440c1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,10 +31,11 @@ Cccms::Application.routes.draw do end end - match '/logout' => 'sessions#destroy', :as => :logout - match '/login' => 'sessions#new', :as => :login - match 'admin/search' => 'admin#search', :as => :admin_search - match 'search' => 'search#index', :as => :search + match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete + match '/login' => 'sessions#new', :as => :login, :via => :get + match 'admin' => 'admin#index', :as => :admin, :via => :get + match 'admin/search' => 'admin#search', :as => :admin_search, :via => :get + match 'search' => 'search#index', :as => :search, :via => :get resources :users @@ -46,12 +47,9 @@ Cccms::Application.routes.draw do resource :session - match 'rss/:action' => 'rss#index', :as => :rss - match 'rss/:action.:format' => 'rss#index' + match 'rss/:action' => 'rss#index', :as => :rss, :via => [:get, :post] + match 'rss/:action.:format' => 'rss#index', :via => [:get, :post] - match '/:controller(/:action(/:id))' - match '/:controller(/:action(/:id.:format))' - - match 'galleries/*page_path' => 'content#render_gallery' - match '/*page_path' => 'content#render_page', :as => :content + match 'galleries/*page_path' => 'content#render_gallery', :via => :get + match '/*page_path' => 'content#render_page', :as => :content, :via => :get end diff --git a/test/test_helper.rb b/test/test_helper.rb index 27e1f0d..549f594 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rails/test_help' module ActiveRecord - class Fixtures + class FixtureSet class << self alias_method :original_create_fixtures, :create_fixtures def create_fixtures(*args) -- cgit v1.3 From a1ddc25da0d2aa79a4d9216ef7792f26233bd38e Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 05:19:28 +0200 Subject: Stage 5 fixes: RouteWithParams removal, Globalize fallbacks, search stub, to_s(:db) → to_fs(:db), LockedByAnotherUser autoload, test environment config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove safe_path helper and content_path shim from link_helper.rb - Update all safe_path call sites in views to use named route helpers directly - Fix Globalize fallbacks via config.i18n.fallbacks in application.rb, remove i18n initializer - Stub Node.search returning none (search disabled pending PostgreSQL upgrade) - Replace to_s(:db) with to_fs(:db) in node.rb, nodes_helper.rb, link_helper.rb, admin view - Move LockedByAnotherUser to app/models/locked_by_another_user.rb for Zeitwerk autoloading - Fix config/environments/test.rb: config.assets removed, cache_classes → enable_reloading, test_order removed, minitest pinned to ~> 5.25 - Fix config/environments/development.rb: cache_classes → enable_reloading - Park search vector migration in doc/ pending PostgreSQL and plpgsql availability --- Gemfile | 1 + Gemfile.lock | 7 ++-- app/helpers/link_helper.rb | 35 +++------------- app/helpers/nodes_helper.rb | 2 +- app/models/locked_by_another_user.rb | 1 + app/models/node.rb | 13 +++--- app/views/admin/_recent_changes.html.erb | 2 +- app/views/content/_search.html.erb | 2 +- app/views/content/_tags.html.erb | 2 +- app/views/layouts/application.html.erb | 4 +- config/application.rb | 1 + config/environments/development.rb | 2 +- config/environments/test.rb | 4 +- config/initializers/i18n.rb | 3 -- config/initializers/will_paginate_patch.rb | 13 ------ ...d_search_vector_to_page_translations.rb.pending | 47 ++++++++++++++++++++++ 16 files changed, 75 insertions(+), 64 deletions(-) create mode 100644 app/models/locked_by_another_user.rb delete mode 100644 config/initializers/i18n.rb delete mode 100644 config/initializers/will_paginate_patch.rb create mode 100644 doc/20260626025705_add_search_vector_to_page_translations.rb.pending (limited to 'config/application.rb') diff --git a/Gemfile b/Gemfile index 2f99c64..2f6e394 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ group :assets do gem 'sass-rails', '~> 6.0' gem 'coffee-rails', '~> 4.0' gem 'uglifier', '>= 1.0.3' + gem 'minitest', '~> 5.25' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 357998d..9d5ec90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,9 +157,7 @@ GEM marcel (1.2.1) mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (6.0.6) - drb (~> 2.0) - prism (~> 1.5) + minitest (5.27.0) net-imap (0.6.4.1) date net-protocol @@ -323,6 +321,7 @@ DEPENDENCIES globalize (~> 7.0) jquery-rails libxml-ruby (~> 5.0) + minitest (~> 5.25) nokogiri (~> 1.18) pg (~> 1.4.6) puma @@ -394,7 +393,7 @@ CHECKSUMS marcel (1.2.1) sha256=1678e9360e32f9eafa917c80029e2f6d10b2715c66a4b87b6d0da9b9cd1f859f mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef mini_portile2 (2.8.9) sha256=0cd7c7f824e010c072e33f68bc02d85a00aeb6fce05bb4819c03dfd3c140c289 - minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1 + minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5 net-imap (0.6.4.1) sha256=29f0360d75a7efd3539f16ac1957dea5c0a51ddeceb348db4553c3120914ea0d net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 39ec495..cb13c8d 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb @@ -1,5 +1,5 @@ module LinkHelper - + def content_path_helper path_array url_for( :controller => :content, @@ -8,11 +8,11 @@ module LinkHelper :page_path => path_array ) end - + def content_url_helper path_array request.protocol + request.host_with_port + content_path_helper(path_array) end - + def link_to_path title, path, html_options = {} return "" if path.nil? @@ -22,9 +22,7 @@ module LinkHelper end active_class = active ? {:class => 'active'} : {:class => 'inactive'} - html_options = html_options.merge(active_class) - locale = params[:locale] || I18n.locale link_to( @@ -39,34 +37,13 @@ module LinkHelper return :class => "selected" end end - + def unlock_link message = "Are you sure you want to unlock?\n" + "Locked by #{@node.lock_owner.login}\n" + - "Last modified #{@page.updated_at.to_s(:db)}" - - link_to 'Unlock', safe_path(:unlock_node_path, @node), :method => :put, :data => { :confirm => message } - end - - # Rails 6.1 workaround: content_path named helper returns RouteWithParams - # when called from within a catch-all glob route request context. - # Rails 6.1 workaround: named route helpers return RouteWithParams when called - # from within a catch-all glob route request context. - # Remove this method when upgrading to Rails 7.0+, where this is fixed. - def safe_path(name, *args) - Rails.application.routes.url_helpers.send(name, *args) - end + "Last modified #{@page.updated_at.to_fs(:db)}" - def content_path(page_path = nil, options = {}) - if page_path.is_a?(Hash) - options = page_path - page_path = options.delete(:page_path) - end - options[:locale] ||= params[:locale] || I18n.locale - Rails.application.routes.url_helpers.content_path( - Array(page_path).join("/").sub(/^\//, ""), - options - ) + link_to 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message } end end diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index 204ad8a..c739ccd 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -31,7 +31,7 @@ module NodesHelper def event_information if @node.event - "#{@node.event.start_time.to_s(:db)} - #{@node.event.end_time.to_s(:db)} > " \ + "#{@node.event.start_time.to_fs(:db)} - #{@node.event.end_time.to_fs(:db)} > " \ "#{link_to 'show', event_path(@node.event)} " \ "#{link_to 'edit', edit_event_path(@node.event)}" else diff --git a/app/models/locked_by_another_user.rb b/app/models/locked_by_another_user.rb new file mode 100644 index 0000000..6f9e272 --- /dev/null +++ b/app/models/locked_by_another_user.rb @@ -0,0 +1 @@ +class LockedByAnotherUser < StandardError; end diff --git a/app/models/node.rb b/app/models/node.rb index f7a70d0..41c3867 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -73,7 +73,7 @@ class Node < ApplicationRecord raise( LockedByAnotherUser, "Page is locked by another user who is working on it! " \ - "Last modification: #{draft.updated_at.to_s(:db)}" + "Last modification: #{draft.updated_at.to_fs(:db)}" ) else lock_for! current_user @@ -211,6 +211,13 @@ class Node < ApplicationRecord self.created_at < new_id_format_date ? unique_path : id end + # TODO: restore full-text search once PostgreSQL is upgraded. + # The tsvector/plpgsql approach requires PostgreSQL 10+ with plpgsql available. + # For now, search is disabled to unblock the Rails 7.2 upgrade. + def self.search(term, _ = {}) + none + end + protected def lock_for! current_user self.lock_owner = current_user @@ -255,7 +262,3 @@ class Node < ApplicationRecord end end end - -class LockedByAnotherUser < StandardError; end - - diff --git a/app/views/admin/_recent_changes.html.erb b/app/views/admin/_recent_changes.html.erb index 300d088..88b5e93 100644 --- a/app/views/admin/_recent_changes.html.erb +++ b/app/views/admin/_recent_changes.html.erb @@ -13,7 +13,7 @@ <%= truncated_title_for_node node %> <%= node.unique_name %> <%= node.draft.user.login rescue "" %> - <%= node.updated_at.to_s(:db) %> + <%= node.updated_at.to_fs(:db) %> <%= link_to 'Show', node_path(node) %> <%= link_to "Revisions", revision_path(:id => node.id) %> diff --git a/app/views/content/_search.html.erb b/app/views/content/_search.html.erb index f732fca..aa91424 100644 --- a/app/views/content/_search.html.erb +++ b/app/views/content/_search.html.erb @@ -1,3 +1,3 @@ -<%= form_tag safe_path(:search_path), :method => 'get' do %> +<%= form_tag search_path, :method => 'get' do %>
<%= text_field_tag :search_term, params[:search_term], :placeholder => 'suchen', :type => 'search' %>
<% end %> diff --git a/app/views/content/_tags.html.erb b/app/views/content/_tags.html.erb index 387f51c..f0e7210 100644 --- a/app/views/content/_tags.html.erb +++ b/app/views/content/_tags.html.erb @@ -3,7 +3,7 @@

Tags

    <% @page.tags.each do |tag| %> -
  • <%= link_to tag.name, safe_path(:tag_path, tag.name) %>
  • +
  • <%= link_to tag.name, tag_path(tag.name) %>
  • <% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 84dcdc6..c5cbf14 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -52,8 +52,8 @@ <% end %> diff --git a/config/application.rb b/config/application.rb index 1a7f32b..d92802f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,6 +54,7 @@ module Cccms # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] config.i18n.default_locale = :de + config.i18n.fallbacks = { en: [:en, :de] } config.filter_parameters += [:password, :password_confirmation] config.serve_static_files = true diff --git a/config/environments/development.rb b/config/environments/development.rb index 8e2e7ef..43a6846 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -4,7 +4,7 @@ Cccms::Application.configure do # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. - config.cache_classes = false + config.enable_reloading = true # Log error messages when you accidentally call methods on nil. diff --git a/config/environments/test.rb b/config/environments/test.rb index a23c6d4..48aafe8 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,6 +1,6 @@ Cccms::Application.configure do - config.cache_classes = true + config.enable_reloading = false config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false @@ -10,10 +10,8 @@ Cccms::Application.configure do config.action_mailer.delivery_method = :test config.active_support.deprecation = :log - config.active_support.test_order = :sorted config.eager_load = false config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } - config.assets.compile = true end diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb deleted file mode 100644 index 0190f63..0000000 --- a/config/initializers/i18n.rb +++ /dev/null @@ -1,3 +0,0 @@ -require "i18n/backend/fallbacks" -I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) -I18n.fallbacks.map "en" => ["de"] diff --git a/config/initializers/will_paginate_patch.rb b/config/initializers/will_paginate_patch.rb deleted file mode 100644 index d03c882..0000000 --- a/config/initializers/will_paginate_patch.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'will_paginate/view_helpers/action_view' - -WillPaginate::ActionView::LinkRenderer.class_eval do - def url(page) - path = @template.request.path - page_param = WillPaginate::PageNumber(page) - if page_param == 1 - path - else - "#{path}?#{@options[:param_name]}=#{page}" - end - end -end diff --git a/doc/20260626025705_add_search_vector_to_page_translations.rb.pending b/doc/20260626025705_add_search_vector_to_page_translations.rb.pending new file mode 100644 index 0000000..0747637 --- /dev/null +++ b/doc/20260626025705_add_search_vector_to_page_translations.rb.pending @@ -0,0 +1,47 @@ +class AddSearchVectorToPageTranslations < ActiveRecord::Migration[7.2] + def up + add_column :page_translations, :search_vector, :tsvector + + execute <<~SQL + UPDATE page_translations + SET search_vector = to_tsvector( + 'simple', + coalesce(title, '') || ' ' || + coalesce(abstract, '') || ' ' || + coalesce(body, '') + ) + SQL + + add_index :page_translations, :search_vector, + using: :gin, + name: 'index_page_translations_on_search_vector' + + execute <<~SQL + CREATE OR REPLACE FUNCTION page_translations_search_vector_update() + RETURNS trigger AS $$ + BEGIN + NEW.search_vector := to_tsvector( + 'simple', + coalesce(NEW.title, '') || ' ' || + coalesce(NEW.abstract, '') || ' ' || + coalesce(NEW.body, '') + ); + RETURN NEW; + END; + $$ LANGUAGE plpgsql; + + CREATE TRIGGER page_translations_search_vector_trigger + BEFORE INSERT OR UPDATE ON page_translations + FOR EACH ROW EXECUTE PROCEDURE page_translations_search_vector_update(); + SQL + end + + def down + execute <<~SQL + DROP TRIGGER IF EXISTS page_translations_search_vector_trigger ON page_translations; + DROP FUNCTION IF EXISTS page_translations_search_vector_update(); + SQL + remove_index :page_translations, name: 'index_page_translations_on_search_vector' + remove_column :page_translations, :search_vector + end +end -- cgit v1.3 From 420506e58fdfc84f1a5bede0a01dedf0af3bb4f3 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 27 Jun 2026 16:58:53 +0200 Subject: Stage 7: Rails 7.2 → 8.1 on Ruby 3.2.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump Rails to 8.1.3 (Ruby unchanged at 3.2.11, new gemset rails8-upgrade) - config.load_defaults 8.1; merge app:update diffs for all environment files - Remove routing-filter 0.7.0; replace with native scope '(:locale)' in routes.rb and default_url_options in ApplicationController - Delete config/initializers/routing_filter_rails71_patch.rb - Replace vendored TinyMCE 3.x (~200 files) with tinymce-rails ~> 8.3; migrate admin_interface.js from jQuery .tinymce()/advanced theme to tinymce.init(); add config/tinymce.yml; note: TinyMCE 7+ is GPL - rails-i18n ~> 8.0 added explicitly (previously indirect dependency) - awesome_nested_set, acts-as-taggable-on pinned to git main/master (gemspec activerecord < 8.1 ceiling; no functional incompatibility; repin to version once upstream releases updated gemspecs) - globalize ~> 7.0, libxml-ruby ~> 5.0, nokogiri ~> 1.18, pg ~> 1.5 - sass-rails, coffee-rails, uglifier moved from :assets group to main (Sprockets 4 convention; :assets group no longer meaningful) - Node: head, draft, lock_owner marked belongs_to optional: true - Page: node, user, editor marked belongs_to optional: true - Static assets in public/images/ and public/javascripts/ referenced via plain HTML tags; Rails 8 load_defaults raises on pipeline helpers for undeclared assets - sessions_controller_test.rb: remove stale require and dead rescue_action - users_controller_test.rb: assert button[type=submit] not input[type=submit] (Rails 8 button_to renders