From c06723ee715512c2033c7786c48f15674585b56b Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 01:59:57 +0200 Subject: Stage 4: Rails 5.2 -> 6.1 on Ruby 2.7.2 - routing-filter 0.6.3 -> 0.7.0 (Rails 6.1 compatibility) - RSS named routes rss_xml/rss_rdf added - RouteWithParams workarounds: will_paginate_patch, content_path shim, safe_path helper - Paperclip removed, replaced with FileAttachment concern (preserves URL scheme) - Assets resource moved to /admin/assets (Sprockets middleware conflict) - ApplicationRecord base class added, all models migrated - Strong parameters added to Assets, Occurrences, Events, MenuItems controllers - update_attributes -> update throughout - render :nothing -> head :ok/:not_found throughout - language_selector rewritten (removes :overwrite_params) - Environment files updated for Rails 6.1 (eager_load, public_file_server, ActionMailer) - Arel::Visitors::DepthFirst and Integer/Float duration patches removed from test_helper - AssetsController tests added (10 tests covering upload, variants, destroy, auth) - ImageMagick geometry: 460x250! for headline crop (not # which is invalid in IM6) 129 runs, 311 assertions, 5 failures (all pre-existing), 0 errors --- config/environments/development.rb | 7 +++++-- config/environments/production.rb | 14 +++++++------- config/environments/test.rb | 7 ++----- config/initializers/arel_patch.rb | 12 ------------ config/initializers/will_paginate_patch.rb | 13 +++++++++++++ config/routes.rb | 11 ++++++++--- 6 files changed, 35 insertions(+), 29 deletions(-) delete mode 100644 config/initializers/arel_patch.rb create mode 100644 config/initializers/will_paginate_patch.rb (limited to 'config') diff --git a/config/environments/development.rb b/config/environments/development.rb index 3813cab8..8e2e7ef8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,7 +7,6 @@ Cccms::Application.configure do config.cache_classes = false # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true @@ -17,6 +16,10 @@ Cccms::Application.configure do config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log - config.serve_static_files = true + config.public_file_server.enabled = true config.eager_load = false + + config.hosts.clear + + config.middleware.delete ExceptionNotification::Rack end diff --git a/config/environments/production.rb b/config/environments/production.rb index 6f2c5bdd..82b918a0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,7 +13,7 @@ Cccms::Application.configure do config.log_level = :info config.active_support.deprecation = :notify - config.eager_load = false + config.eager_load = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new @@ -30,11 +30,11 @@ Cccms::Application.configure do # Enable threaded mode # config.threadsafe! - ActionMailer::Base.delivery_method = :sendmail - ActionMailer::Base.sendmail_settings = { - :location => '/usr/sbin/sendmail', - :arguments => '-i -t' + config.action_mailer.delivery_method = :sendmail + config.action_mailer.sendmail_settings = { + location: '/usr/sbin/sendmail', + arguments: '-i -t' } - ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.raise_delivery_errors = true + config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = true end diff --git a/config/environments/test.rb b/config/environments/test.rb index 858bebb8..a23c6d46 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -2,9 +2,6 @@ Cccms::Application.configure do config.cache_classes = true - # Log error messages when you accidentally call methods on nil. - # config.whiny_nils = true # removed in Rails 4 - config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false @@ -16,7 +13,7 @@ Cccms::Application.configure do config.active_support.test_order = :sorted config.eager_load = false - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + 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/arel_patch.rb b/config/initializers/arel_patch.rb deleted file mode 100644 index 753a72b0..00000000 --- a/config/initializers/arel_patch.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'arel' -module Arel - module Visitors - [ToSql, DepthFirst].each do |visitor| - visitor.class_eval do - def visit_Integer(o, collector = nil) - collector ? collector << o.to_s : o.to_s - end - end - end - end -end diff --git a/config/initializers/will_paginate_patch.rb b/config/initializers/will_paginate_patch.rb new file mode 100644 index 00000000..d03c8828 --- /dev/null +++ b/config/initializers/will_paginate_patch.rb @@ -0,0 +1,13 @@ +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/config/routes.rb b/config/routes.rb index 4a440c13..c3fd5c6d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,6 @@ Cccms::Application.routes.draw do root :to => 'content#render_page', :page_path => ['home'], :locale => 'de' - resources :assets resources :tags resources :occurrences resources :events @@ -31,6 +30,10 @@ Cccms::Application.routes.draw do end end + scope '/admin' do + resources :assets + end + match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete match '/login' => 'sessions#new', :as => :login, :via => :get match 'admin' => 'admin#index', :as => :admin, :via => :get @@ -47,8 +50,10 @@ Cccms::Application.routes.draw do resource :session - match 'rss/:action' => 'rss#index', :as => :rss, :via => [:get, :post] - match 'rss/:action.:format' => 'rss#index', :via => [:get, :post] + get 'rss/updates', :to => 'rss#updates', :as => :rss + get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed, + :constraints => { :format => /xml|rdf/ } + get 'rss/recent_changes', :to => 'rss#recent_changes' match 'galleries/*page_path' => 'content#render_gallery', :via => :get match '/*page_path' => 'content#render_page', :as => :content, :via => :get -- cgit v1.3