Upgrade Rails to 8.1.3

This commit is contained in:
2026-05-03 17:48:30 +02:00
parent c4def9cd86
commit 78639b4c1e
12 changed files with 113 additions and 78 deletions

View File

@@ -1,7 +1,11 @@
source "https://rubygems.org" source "https://rubygems.org"
# The requirement for the Ruby version comes from Rails # The requirement for the Ruby version comes from Rails
gem "rails", "~> 8.0.5" # NOTE: after updating Rails make sure that schema dump is not sorted:
# v8.1.3/activerecord/lib/active_record/schema_dumper.rb#L195
# Waiting for this change to be reverted/configuration setting added:
# https://github.com/rails/rails/pull/56842, https://github.com/rails/rails/pull/55414
gem "rails", "~> 8.1.3"
gem "sprockets-rails" gem "sprockets-rails"
gem "puma", "~> 6.0" gem "puma", "~> 6.0"
gem "sassc-rails" gem "sassc-rails"

View File

@@ -1,29 +1,31 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (8.0.5) action_text-trix (2.1.18)
actionpack (= 8.0.5) railties
activesupport (= 8.0.5) actioncable (8.1.3)
actionpack (= 8.1.3)
activesupport (= 8.1.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
actionmailbox (8.0.5) actionmailbox (8.1.3)
actionpack (= 8.0.5) actionpack (= 8.1.3)
activejob (= 8.0.5) activejob (= 8.1.3)
activerecord (= 8.0.5) activerecord (= 8.1.3)
activestorage (= 8.0.5) activestorage (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
mail (>= 2.8.0) mail (>= 2.8.0)
actionmailer (8.0.5) actionmailer (8.1.3)
actionpack (= 8.0.5) actionpack (= 8.1.3)
actionview (= 8.0.5) actionview (= 8.1.3)
activejob (= 8.0.5) activejob (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
mail (>= 2.8.0) mail (>= 2.8.0)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
actionpack (8.0.5) actionpack (8.1.3)
actionview (= 8.0.5) actionview (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
rack (>= 2.2.4) rack (>= 2.2.4)
rack-session (>= 1.0.1) rack-session (>= 1.0.1)
@@ -31,42 +33,43 @@ GEM
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6) rails-html-sanitizer (~> 1.6)
useragent (~> 0.16) useragent (~> 0.16)
actiontext (8.0.5) actiontext (8.1.3)
actionpack (= 8.0.5) action_text-trix (~> 2.1.15)
activerecord (= 8.0.5) actionpack (= 8.1.3)
activestorage (= 8.0.5) activerecord (= 8.1.3)
activesupport (= 8.0.5) activestorage (= 8.1.3)
activesupport (= 8.1.3)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (8.0.5) actionview (8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.11) erubi (~> 1.11)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6) rails-html-sanitizer (~> 1.6)
activejob (8.0.5) activejob (8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (8.0.5) activemodel (8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
activerecord (8.0.5) activerecord (8.1.3)
activemodel (= 8.0.5) activemodel (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
timeout (>= 0.4.0) timeout (>= 0.4.0)
activestorage (8.0.5) activestorage (8.1.3)
actionpack (= 8.0.5) actionpack (= 8.1.3)
activejob (= 8.0.5) activejob (= 8.1.3)
activerecord (= 8.0.5) activerecord (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
marcel (~> 1.0) marcel (~> 1.0)
activesupport (8.0.5) activesupport (8.1.3)
base64 base64
benchmark (>= 0.3)
bigdecimal bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1) concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5) connection_pool (>= 2.2.5)
drb drb
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
json
logger (>= 1.4.2) logger (>= 1.4.2)
minitest (>= 5.1) minitest (>= 5.1)
securerandom (>= 0.3) securerandom (>= 0.3)
@@ -76,7 +79,6 @@ GEM
public_suffix (>= 2.0.2, < 8.0) public_suffix (>= 2.0.2, < 8.0)
base64 (0.3.0) base64 (0.3.0)
bcrypt (3.1.22) bcrypt (3.1.22)
benchmark (0.5.0)
bigdecimal (4.1.2) bigdecimal (4.1.2)
bindex (0.8.1) bindex (0.8.1)
builder (3.3.0) builder (3.3.0)
@@ -126,6 +128,7 @@ GEM
prism (>= 1.3.0) prism (>= 1.3.0)
rdoc (>= 4.0.0) rdoc (>= 4.0.0)
reline (>= 0.4.2) reline (>= 0.4.2)
json (2.19.4)
logger (1.7.0) logger (1.7.0)
loofah (2.25.1) loofah (2.25.1)
crass (~> 1.0.2) crass (~> 1.0.2)
@@ -139,12 +142,12 @@ GEM
marcel (1.1.0) marcel (1.1.0)
matrix (0.4.3) matrix (0.4.3)
mini_mime (1.1.5) mini_mime (1.1.5)
minitest (6.0.5) minitest (6.0.6)
drb (~> 2.0) drb (~> 2.0)
prism (~> 1.5) prism (~> 1.5)
mysql2 (0.5.7) mysql2 (0.5.7)
bigdecimal bigdecimal
net-imap (0.6.3) net-imap (0.6.4)
date date
net-protocol net-protocol
net-pop (0.1.2) net-pop (0.1.2)
@@ -154,21 +157,21 @@ GEM
net-smtp (0.5.1) net-smtp (0.5.1)
net-protocol net-protocol
nio4r (2.7.5) nio4r (2.7.5)
nokogiri (1.19.2-aarch64-linux-gnu) nokogiri (1.19.3-aarch64-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-aarch64-linux-musl) nokogiri (1.19.3-aarch64-linux-musl)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-arm-linux-gnu) nokogiri (1.19.3-arm-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-arm-linux-musl) nokogiri (1.19.3-arm-linux-musl)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-arm64-darwin) nokogiri (1.19.3-arm64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-x86_64-darwin) nokogiri (1.19.3-x86_64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-x86_64-linux-gnu) nokogiri (1.19.3-x86_64-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.19.2-x86_64-linux-musl) nokogiri (1.19.3-x86_64-linux-musl)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pg (1.6.3) pg (1.6.3)
@@ -197,20 +200,20 @@ GEM
rack (>= 1.3) rack (>= 1.3)
rackup (2.3.1) rackup (2.3.1)
rack (>= 3) rack (>= 3)
rails (8.0.5) rails (8.1.3)
actioncable (= 8.0.5) actioncable (= 8.1.3)
actionmailbox (= 8.0.5) actionmailbox (= 8.1.3)
actionmailer (= 8.0.5) actionmailer (= 8.1.3)
actionpack (= 8.0.5) actionpack (= 8.1.3)
actiontext (= 8.0.5) actiontext (= 8.1.3)
actionview (= 8.0.5) actionview (= 8.1.3)
activejob (= 8.0.5) activejob (= 8.1.3)
activemodel (= 8.0.5) activemodel (= 8.1.3)
activerecord (= 8.0.5) activerecord (= 8.1.3)
activestorage (= 8.0.5) activestorage (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 8.0.5) railties (= 8.1.3)
rails-dom-testing (2.3.0) rails-dom-testing (2.3.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
minitest minitest
@@ -218,9 +221,9 @@ GEM
rails-html-sanitizer (1.7.0) rails-html-sanitizer (1.7.0)
loofah (~> 2.25) loofah (~> 2.25)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.0.5) railties (8.1.3)
actionpack (= 8.0.5) actionpack (= 8.1.3)
activesupport (= 8.0.5) activesupport (= 8.1.3)
irb (~> 1.13) irb (~> 1.13)
rackup (>= 1.0.0) rackup (>= 1.0.0)
rake (>= 12.2) rake (>= 12.2)
@@ -239,7 +242,7 @@ GEM
actionpack (>= 7.0) actionpack (>= 7.0)
railties (>= 7.0) railties (>= 7.0)
rexml (3.4.4) rexml (3.4.4)
rubyzip (3.2.2) rubyzip (3.3.0)
sassc (2.4.0) sassc (2.4.0)
ffi (~> 1.9) ffi (~> 1.9)
sassc-rails (2.1.2) sassc-rails (2.1.2)
@@ -316,7 +319,7 @@ DEPENDENCIES
mysql2 (~> 0.5) mysql2 (~> 0.5)
pg (~> 1.5) pg (~> 1.5)
puma (~> 6.0) puma (~> 6.0)
rails (~> 8.0.5) rails (~> 8.1.3)
sassc-rails sassc-rails
selenium-webdriver selenium-webdriver
sprockets-rails sprockets-rails

View File

@@ -208,9 +208,7 @@ module ApplicationHelper
def image_link_to_unless_current(name, image = nil, options = nil, html_options = {}) def image_link_to_unless_current(name, image = nil, options = nil, html_options = {})
name, html_options = link_or_button_options(:link, name, image, html_options) name, html_options = link_or_button_options(:link, name, image, html_options)
# NOTE: Starting from Rails 8.1.0, below condition can be replaced with: if current_page?(options, method: [:get, :post])
# current_page?(options, method: [:get, :post])
if request.path == url_for(options)
html_options = html_options.deep_merge DISABLED_ATTRIBUTES html_options = html_options.deep_merge DISABLED_ATTRIBUTES
end end
link_to name, options, html_options link_to name, options, html_options

6
bin/ci Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require_relative "../config/boot"
require "active_support/continuous_integration"
CI = ActiveSupport::ContinuousIntegration
require_relative "../config/ci.rb"

0
bin/fixinme.service.dist Normal file → Executable file
View File

View File

@@ -22,6 +22,7 @@ FileUtils.chdir APP_ROOT do
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! "bin/rails db:prepare" system! "bin/rails db:prepare"
system! "bin/rails db:reset" if ARGV.include?("--reset")
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear" system! "bin/rails log:clear tmp:clear"

View File

@@ -21,7 +21,7 @@ Bundler.require(*Rails.groups)
module FixinMe module FixinMe
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.0 config.load_defaults 8.1
# Please, add to the `ignore` list any other `lib` subdirectories that do # Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded. # not contain `.rb` files, or that should not be reloaded or eager loaded.

20
config/ci.rb Normal file
View File

@@ -0,0 +1,20 @@
# Run using bin/ci
CI.run do
step "Setup", "bin/setup --skip-server"
step "Security: Importmap vulnerability audit", "bin/importmap audit"
step "Tests: Rails", "bin/rails test"
step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
# Optional: Run system tests
# step "Tests: System", "bin/rails test:system"
# Optional: set a green GitHub commit status to unblock PR merge.
# Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
# if success?
# step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
# else
# failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
# end
end

View File

@@ -49,6 +49,9 @@ Rails.application.configure do
# Highlight code that enqueued background job in logs. # Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true config.active_job.verbose_enqueue_logs = true
# Highlight code that triggered redirect in logs.
config.action_dispatch.verbose_redirect_logs = true
# Raises error for missing translations. # Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true # config.i18n.raise_on_missing_translations = true

View File

@@ -34,7 +34,7 @@ Rails.application.configure do
config.log_tags = [ :request_id ] config.log_tags = [ :request_id ]
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
# Change to "debug" to log everything (including potentially personally-identifiable information!) # Change to "debug" to log everything (including potentially personally-identifiable information!).
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# Prevent health checks from clogging up the logs. # Prevent health checks from clogging up the logs.
@@ -53,7 +53,7 @@ Rails.application.configure do
# Set this to true and configure the email server for immediate delivery to raise delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
# config.action_mailer.smtp_settings = { # config.action_mailer.smtp_settings = {
# user_name: Rails.application.credentials.dig(:smtp, :user_name), # user_name: Rails.application.credentials.dig(:smtp, :user_name),
# password: Rails.application.credentials.dig(:smtp, :password), # password: Rails.application.credentials.dig(:smtp, :password),

View File

@@ -20,6 +20,10 @@
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src style-src) # config.content_security_policy_nonce_directives = %w(script-src style-src)
# #
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
# # config.content_security_policy_nonce_auto = true
#
# # Report violations without enforcing the policy. # # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true # # config.content_security_policy_report_only = true
# end # end

View File

@@ -1,9 +1,5 @@
require 'application_system_test_case' require 'application_system_test_case'
# NOTE: remove constant to avoid warnings due to double loading of
# rails/tasks/statistics.rake. To be removed after upgrade to Rails 8.1.
Object.send(:remove_const, :STATS_DIRECTORIES)
Rails.application.load_tasks Rails.application.load_tasks
# NOTE: for some reason task for checking pending migrations messes up # NOTE: for some reason task for checking pending migrations messes up
# transaction when run during test. It causes all DB changes made before its # transaction when run during test. It causes all DB changes made before its