Skip to content

Commit

Permalink
Merge branch 'thoughtbot:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrizian authored Jan 29, 2025
2 parents 186b8dc + a41ffb1 commit 3d73f6a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
42 changes: 24 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ GEM
xpath (~> 3.2)
childprocess (5.1.0)
logger (~> 1.5)
concurrent-ruby (1.3.4)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crack (1.0.0)
bigdecimal
Expand Down Expand Up @@ -152,7 +152,7 @@ GEM
hashdiff (1.1.2)
highline (3.1.2)
reline
i18n (1.14.6)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.14)
activesupport (>= 4.0.2)
Expand All @@ -168,7 +168,8 @@ GEM
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.8.0)
irb (1.14.3)
irb (1.15.1)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jsbundling-rails (1.3.1)
Expand All @@ -189,12 +190,13 @@ GEM
kaminari-i18n (0.5.0)
kaminari
rails
language_server-protocol (3.17.0.3)
launchy (3.0.1)
language_server-protocol (3.17.0.4)
launchy (3.1.0)
addressable (~> 2.8)
childprocess (~> 5.0)
logger (~> 1.6)
lint_roller (1.1.0)
logger (1.6.4)
logger (1.6.5)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -217,16 +219,20 @@ GEM
net-protocol (0.2.2)
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.1)
nokogiri (1.18.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.6.0)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pg (1.5.9)
psych (5.2.2)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
psych (5.2.3)
date
stringio
public_suffix (6.0.1)
Expand Down Expand Up @@ -278,7 +284,7 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.10.0)
rdoc (6.11.0)
psych (>= 4.0.0)
redcarpet (3.6.0)
regexp_parser (2.10.0)
Expand All @@ -302,7 +308,7 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
rubocop (1.69.2)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -312,7 +318,7 @@ GEM
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
Expand All @@ -323,16 +329,16 @@ GEM
logger
rubyzip (2.4.1)
securerandom (0.4.1)
selenium-webdriver (4.27.0)
selenium-webdriver (4.28.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sentry-rails (5.22.1)
sentry-rails (5.22.3)
railties (>= 5.0)
sentry-ruby (~> 5.22.1)
sentry-ruby (5.22.1)
sentry-ruby (~> 5.22.3)
sentry-ruby (5.22.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shoulda-matchers (6.4.0)
Expand All @@ -344,10 +350,10 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.43.0)
standard (1.44.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.69.1)
rubocop (~> 1.70.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
Expand Down
20 changes: 10 additions & 10 deletions lib/administrate/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ def resources
end

def routes
@routes ||= all_routes.select do |controller, _action|
controller.starts_with?("#{namespace}/")
end.map do |controller, action|
[controller.gsub(/^#{namespace}\//, ""), action]
@routes ||= begin
prefix = "#{namespace}/".freeze
Rails.application.routes.routes.filter_map do |route|
next unless route.defaults[:controller]&.start_with?(prefix)

[
route.defaults[:controller].delete_prefix(prefix),
route.defaults[:action]
]
end
end
end

Expand All @@ -25,11 +31,5 @@ def resources_with_index_route
private

attr_reader :namespace

def all_routes
Rails.application.routes.routes.map do |route|
route.defaults.values_at(:controller, :action).map(&:to_s)
end
end
end
end
2 changes: 2 additions & 0 deletions spec/example_app/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative "boot"

require "logger"
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
Expand Down Expand Up @@ -27,6 +28,7 @@ class Application < Rails::Application

config.action_controller.action_on_unpermitted_parameters = :raise
config.active_record.time_zone_aware_types = %i[datetime time]
config.active_support.to_time_preserves_timezone = :zone

# Opt-out of FLoC: https://amifloced.org/
config.action_dispatch
Expand Down

0 comments on commit 3d73f6a

Please sign in to comment.