Skip to content

Commit

Permalink
Configure separate routes file for Dashboard Engine to fix doubly-loa…
Browse files Browse the repository at this point in the history
…ded routes.rb (#8)
  • Loading branch information
bensheldon authored Sep 29, 2024
1 parent 8efff4e commit 7910984
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def destroy
@session_window.events.delete_all
@session_window.delete

redirect_to "/spectator_sport_dashboard"
redirect_to root_path
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions config/dashboard_routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SpectatorSport::Dashboard::Engine.routes.draw do
root to: "dashboards#index"
resources :session_windows, only: [ :show, :destroy ]
end
6 changes: 0 additions & 6 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
SpectatorSport::Engine.routes.draw do
resources :events, only: [ :index, :create ]
end

SpectatorSport::Dashboard::Engine.routes.draw do
get "/", to: "dashboards#index"
# resources :dashboards, only: [ :show, :destroy ]
resources :session_windows, only: [ :show, :destroy ]
end
1 change: 1 addition & 0 deletions lib/spectator_sport/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Engine < ::Rails::Engine
module Dashboard
class Engine < ::Rails::Engine
isolate_namespace SpectatorSport::Dashboard
paths.add "config/routes.rb", with: "config/dashboard_routes.rb"
end
end
end

0 comments on commit 7910984

Please sign in to comment.