Skip to content

Commit a896333

Browse files
authored
[Bug Fix] Fix /docs/dropdown_menu 404 (#428) (#429)
* [Bug Fix] Fix DropdownMenu docs example: replace nonexistent DialogClose The 'Non-navigational item' example (added in #427) referenced a DialogClose component that does not exist in the gem. VisualCodeExample evaluates the snippet at render time, so it raised NoMethodError and the whole /docs/dropdown_menu page failed to render. Close the dialog with the documented pattern instead: a Button wired to click->ruby-ui--dialog#dismiss (same approach used in dialog_docs.rb). Fixes #428 * [Bug Fix] Dispatch exceptions through the router so 500s aren't masked as 404 config.exceptions_app pointed at a lambda that always rendered the not_found action, so every unhandled error (including 500s such as a raising view) surfaced as a 404. That masked the DropdownMenu render error behind a misleading 'not found' page. Point exceptions_app at the router instead; the /404 and /500 routes already exist, so the response status now matches the actual error and ErrorsController#internal_server_error is finally reachable.
1 parent d799b7a commit a896333

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

docs/app/views/docs/dropdown_menu.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def view_template
4343
DialogDescription { "This action cannot be undone." }
4444
end
4545
DialogFooter do
46-
DialogClose { Button(variant: :destructive) { "Delete" } }
46+
Button(variant: :destructive, data: { action: 'click->ruby-ui--dialog#dismiss' }) { "Delete" }
4747
end
4848
end
4949
end

docs/config/application.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class Application < Rails::Application
2424
# config.time_zone = "Central Time (US & Canada)"
2525
# config.eager_load_paths << Rails.root.join("extras")
2626

27-
config.exceptions_app = ->(env) { ErrorsController.action(:not_found).call(env) }
27+
# Dispatch exceptions through the router (see the /404 and /500 routes) so the
28+
# response status matches the actual error. A bare lambda to a single action
29+
# rendered every failure as 404, masking 500s (e.g. a raising view) as "not found".
30+
config.exceptions_app = routes
2831
end
2932
end

0 commit comments

Comments
 (0)