From fa0ccc43010297c0c10e3075095c0a9171989498 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 04:05:04 +0200 Subject: Stage 5: Rails 6.1 → 7.2 on Ruby 3.2.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump Rails to 7.2.3, Ruby to 3.2.11 (new gemset rails7-upgrade) - pg pinned to 1.4.6 (bridge: Ruby 3.2 compatible, PostgreSQL 9.6 tolerant) - acts-as-taggable-on → 12.x (Rails 7.2 + Ruby 3.2 support) - awesome_nested_set → 3.7.0 (Rails 7.2 support, avoids 3.9.0 lft/rgt bug) - globalize → 7.0 (Rails 7.x required) - libxml-ruby → 5.x (Ruby 3.2 required) - unicorn → 6.x; fix unicorn.rb: RAILS_ROOT→Rails.root, RAILS_ENV→ENV, File.exists?→File.exist? - Add puma for development server - Remove dead initializers: assets.rb, ruby2.rb, backtrace_silencers.rb, new_rails_defaults.rb - Fix File.exists? → File.exist? in page.rb and authors_importer.rb - Add routing_filter_rails71_patch.rb (restores params[:locale] on Rails 7.1+) --- config/initializers/assets.rb | 1 - config/initializers/backtrace_silencers.rb | 7 ---- config/initializers/new_rails_defaults.rb | 19 ----------- .../initializers/routing_filter_rails71_patch.rb | 38 ++++++++++++++++++++++ config/initializers/ruby2.rb | 16 --------- 5 files changed, 38 insertions(+), 43 deletions(-) delete mode 100644 config/initializers/assets.rb delete mode 100644 config/initializers/backtrace_silencers.rb delete mode 100644 config/initializers/new_rails_defaults.rb create mode 100644 config/initializers/routing_filter_rails71_patch.rb delete mode 100644 config/initializers/ruby2.rb (limited to 'config/initializers') diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb deleted file mode 100644 index 938e89de..00000000 --- a/config/initializers/assets.rb +++ /dev/null @@ -1 +0,0 @@ -Rails.application.config.assets.precompile += %w( jquery.js jquery_ujs.js ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index c2169ed0..00000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. -# Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb deleted file mode 100644 index 8ec3186c..00000000 --- a/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -if defined?(ActiveRecord) - # Include Active Record class name as root for JSON serialized output. - ActiveRecord::Base.include_root_in_json = true - - # Store the full class name (including module namespace) in STI type column. - ActiveRecord::Base.store_full_sti_class = true -end - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/config/initializers/routing_filter_rails71_patch.rb b/config/initializers/routing_filter_rails71_patch.rb new file mode 100644 index 00000000..35e3576b --- /dev/null +++ b/config/initializers/routing_filter_rails71_patch.rb @@ -0,0 +1,38 @@ +# routing-filter 0.7.0 is broken on Rails 7.1+ due to a change in how +# ActionDispatch::Journey::Router#find_routes yields results (lazy iterator +# vs eager enumerable). This patch restores the expected behaviour. +# See: https://github.com/svenfuchs/routing-filter/pull/87 +# Remove this file if routing-filter ever releases a fixed version, +# or when routing-filter is replaced with native Rails i18n scope routing. + +if Gem.loaded_specs['routing-filter'].version > Gem::Version.new('0.7.0') + raise 'routing-filter has been updated — check if this patch is still needed and remove it if so.' +end + +ActionDispatchJourneyRouterWithFiltering.remove_method(:find_routes) + +module RoutingFilterRails71Fix + def find_routes(env) + path = env.is_a?(Hash) ? env['PATH_INFO'] : env.path_info + filter_parameters = {} + original_path = path.dup + + @routes.filters.run(:around_recognize, path, env) do + filter_parameters + end + + super(env) do |match, parameters, route| + parameters = parameters.merge(filter_parameters) + + if env.is_a?(Hash) + env['PATH_INFO'] = original_path + else + env.path_info = original_path + end + + yield [match, parameters, route] + end + end +end + +ActionDispatch::Journey::Router.prepend(RoutingFilterRails71Fix) diff --git a/config/initializers/ruby2.rb b/config/initializers/ruby2.rb deleted file mode 100644 index d2d62aa6..00000000 --- a/config/initializers/ruby2.rb +++ /dev/null @@ -1,16 +0,0 @@ -if Rails::VERSION::MAJOR == 2 && RUBY_VERSION >= '2.0.0' - module ActiveRecord - module Associations - class AssociationProxy - def send(method, *args) - if proxy_respond_to?(method, true) - super - else - load_target - @target.send(method, *args) - end - end - end - end - end -end -- cgit v1.3