diff --git a/gemfiles/activeadmin_4.0.gemfile b/gemfiles/activeadmin_4.0.gemfile index f649b68..3a963d1 100644 --- a/gemfiles/activeadmin_4.0.gemfile +++ b/gemfiles/activeadmin_4.0.gemfile @@ -8,10 +8,7 @@ gemspec path: ".." # the Sprockets/Sassc pipeline with Propshaft + importmap + cssbundling + # Tailwind, so the asset gems differ entirely from the 3.5 gemfile. gem "activeadmin", ">= 4.0.0.beta", "< 5" -# Blocked on Rails 8.1: railties 8.1 calls `delegate_missing_to` in -# Rails::Initializable::Collection without requiring the ActiveSupport -# core ext, so this gem's `require "rails/railtie"` raises NoMethodError. -gem "rails", "~> 8.0.0" +gem "rails", "~> 8.1.0" # openid_connect 2.x line (faraday 2.x). gem "omniauth_openid_connect", "~> 0.8.0" @@ -20,7 +17,3 @@ gem "propshaft" gem "importmap-rails" gem "cssbundling-rails" gem "tailwindcss-rails", "~> 4.0" - -# See the note in activeadmin_3.5.gemfile: json 3.0 removed the -# `quirks_mode` keyword ActiveSupport::JSON still passes. -gem "json", "< 3" diff --git a/lib/activeadmin-oidc.rb b/lib/activeadmin-oidc.rb index 7086095..fc74f40 100644 --- a/lib/activeadmin-oidc.rb +++ b/lib/activeadmin-oidc.rb @@ -18,6 +18,17 @@ # at file load, so pull in the minimal Railtie base class first — this # keeps the require safe even in spec_helper contexts where the full # Rails stack hasn't been initialized yet. +# +# The delegation core ext has to come first. railties 8.1's +# `rails/initializable.rb` calls `delegate_missing_to` in the body of +# `Rails::Initializable::Collection` but only requires "tsort", and +# `rails/railtie.rb` requires `rails/initializable` before any +# ActiveSupport core ext. So on Rails 8.1 a bare `require +# "rails/railtie"` raises `NoMethodError: undefined method +# 'delegate_missing_to'`. Requiring the one core ext it needs keeps the +# intent above intact — we still load only the minimal Railtie base +# class, not all of Rails. +require "active_support/core_ext/module/delegation" require "rails/railtie" require "omniauth/rails_csrf_protection"