summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-26 04:05:04 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-26 04:05:04 +0200
commitfa0ccc43010297c0c10e3075095c0a9171989498 (patch)
tree3d857550ce094a4c4e860ce25f1034923c30ce52 /config/initializers
parentc06723ee715512c2033c7786c48f15674585b56b (diff)
Stage 5: Rails 6.1 → 7.2 on Ruby 3.2.11
- 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+)
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/assets.rb1
-rw-r--r--config/initializers/backtrace_silencers.rb7
-rw-r--r--config/initializers/new_rails_defaults.rb19
-rw-r--r--config/initializers/routing_filter_rails71_patch.rb38
-rw-r--r--config/initializers/ruby2.rb16
5 files changed, 38 insertions, 43 deletions
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
deleted file mode 100644
index 938e89d..0000000
--- a/config/initializers/assets.rb
+++ /dev/null
@@ -1 +0,0 @@
1Rails.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 c2169ed..0000000
--- a/config/initializers/backtrace_silencers.rb
+++ /dev/null
@@ -1,7 +0,0 @@
1# Be sure to restart your server when you modify this file.
2
3# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
6# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7# 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 8ec3186..0000000
--- a/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,19 +0,0 @@
1# Be sure to restart your server when you modify this file.
2
3# These settings change the behavior of Rails 2 apps and will be defaults
4# for Rails 3. You can remove this initializer when Rails 3 is released.
5
6if defined?(ActiveRecord)
7 # Include Active Record class name as root for JSON serialized output.
8 ActiveRecord::Base.include_root_in_json = true
9
10 # Store the full class name (including module namespace) in STI type column.
11 ActiveRecord::Base.store_full_sti_class = true
12end
13
14# Use ISO 8601 format for JSON serialized times and dates.
15ActiveSupport.use_standard_json_time_format = true
16
17# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18# if you're including raw json in an HTML page.
19ActiveSupport.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 0000000..35e3576
--- /dev/null
+++ b/config/initializers/routing_filter_rails71_patch.rb
@@ -0,0 +1,38 @@
1# routing-filter 0.7.0 is broken on Rails 7.1+ due to a change in how
2# ActionDispatch::Journey::Router#find_routes yields results (lazy iterator
3# vs eager enumerable). This patch restores the expected behaviour.
4# See: https://github.com/svenfuchs/routing-filter/pull/87
5# Remove this file if routing-filter ever releases a fixed version,
6# or when routing-filter is replaced with native Rails i18n scope routing.
7
8if Gem.loaded_specs['routing-filter'].version > Gem::Version.new('0.7.0')
9 raise 'routing-filter has been updated — check if this patch is still needed and remove it if so.'
10end
11
12ActionDispatchJourneyRouterWithFiltering.remove_method(:find_routes)
13
14module RoutingFilterRails71Fix
15 def find_routes(env)
16 path = env.is_a?(Hash) ? env['PATH_INFO'] : env.path_info
17 filter_parameters = {}
18 original_path = path.dup
19
20 @routes.filters.run(:around_recognize, path, env) do
21 filter_parameters
22 end
23
24 super(env) do |match, parameters, route|
25 parameters = parameters.merge(filter_parameters)
26
27 if env.is_a?(Hash)
28 env['PATH_INFO'] = original_path
29 else
30 env.path_info = original_path
31 end
32
33 yield [match, parameters, route]
34 end
35 end
36end
37
38ActionDispatch::Journey::Router.prepend(RoutingFilterRails71Fix)
diff --git a/config/initializers/ruby2.rb b/config/initializers/ruby2.rb
deleted file mode 100644
index d2d62aa..0000000
--- a/config/initializers/ruby2.rb
+++ /dev/null
@@ -1,16 +0,0 @@
1if Rails::VERSION::MAJOR == 2 && RUBY_VERSION >= '2.0.0'
2 module ActiveRecord
3 module Associations
4 class AssociationProxy
5 def send(method, *args)
6 if proxy_respond_to?(method, true)
7 super
8 else
9 load_target
10 @target.send(method, *args)
11 end
12 end
13 end
14 end
15 end
16end