Skip to content

Commit

Permalink
Spaces - BYODomains: Fix broken Space/edit page
Browse files Browse the repository at this point in the history
#74
#1067

Turns out, having the Space routes split into two sections meant some of
the updates to the routes did not get applied for spaces with
BYO-Domains.

This... fixes that...
  • Loading branch information
zspencer committed Jan 24, 2023
1 parent b2566ea commit 1dc7ed5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
17 changes: 17 additions & 0 deletions app/lib/space_routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module SpaceRoutes
def self.append_routes(router)
router.resource :authenticated_session, only: %i[new create update destroy show]
router.resources :invitations, only: %i[create destroy index] do
router.resource :rsvp, only: %i[show update]
end
router.resources :rooms, only: %i[show edit update new create destroy] do
Furniture.append_routes(router)
router.resource :waiting_room, only: %i[show update]
router.resources :furniture_placements, only: %i[create edit update destroy]
end

router.resources :utility_hookups

router.resources :memberships, only: %I[index show destroy]
end
end
30 changes: 2 additions & 28 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,7 @@
# post "/auth/:provider/callback", "sessions#create"
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources :spaces, only: %I[show edit update create destroy] do
resource :authenticated_session, only: %i[new create update destroy show]

resources :invitations, only: %i[create destroy index] do
resource :rsvp, only: %i[show update]
end

resources :rooms, only: %i[show edit update new create destroy] do
Furniture.append_routes(self)
resource :waiting_room, only: %i[show update]
resources :furniture_placements, only: %i[create edit update destroy]
end

resources :utility_hookups

resources :memberships, only: %I[index show destroy]
SpaceRoutes.append_routes(self)
end

resources :memberships, only: %I[create]
Expand All @@ -42,18 +28,6 @@
get "/" => "spaces#show"
put "/" => "spaces#update"

resources :invitations, only: %i[create destroy index] do
resource :rsvp, only: %i[show update]
end

resources :memberships, only: %i[index show destroy]

resources :utility_hookups, only: %I[create edit update destroy index]

resource :authenticated_session, only: %i[new create update destroy show]

resources :rooms, only: %i[show edit update new create destroy] do
Furniture.append_routes(self)
end
SpaceRoutes.append_routes(self)
end
end

0 comments on commit 1dc7ed5

Please sign in to comment.