Skip to content

Commit 2222744

Browse files
committed
refactor:application.rbからexceptions_app設定を削除しproduction/test環境へ移行
- application.rbからを削除 - production.rbとtest.rbの直後にを追加 - 開発環境では従来のバックトレース表示()を維持し、ローカルデバッグ性を確保 - 本番/CI環境では例外を自前ルーティング(,,)へ委譲することで一貫したカスタムエラー画面を提供
1 parent 4e8612b commit 2222744

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

config/application.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ class Application < Rails::Application
1111
# Initialize configuration defaults for originally generated Rails version.
1212
config.load_defaults 8.0
1313

14-
# Rambulance が提供するエラー用ルーティングを使うようにする
15-
config.exceptions_app = self.routes
16-
17-
1814
# Please, add to the `ignore` list any other `lib` subdirectories that do
1915
# not contain `.rb` files, or that should not be reloaded or eager loaded.
2016
# Common ones are `templates`, `generators`, or `middleware`, for example.

config/environments/production.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# Full error reports are disabled.
1313
config.consider_all_requests_local = false
1414

15+
# 本番環境では例外を自前ルーティングへ
16+
config.exceptions_app = self.routes
17+
1518
# Turn on fragment caching in view templates.
1619
config.action_controller.perform_caching = true
1720

config/environments/test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
config.consider_all_requests_local = true
2323
config.cache_store = :null_store
2424

25+
# テスト環境でも例外を自前ルーティングへ
26+
config.exceptions_app = self.routes
27+
2528
# Render exception templates for rescuable exceptions and raise for other exceptions.
2629
config.action_dispatch.show_exceptions = :rescuable
2730

0 commit comments

Comments
 (0)