LoginSignup
0
1

More than 3 years have passed since last update.

Railsのエラー画面を見やすくするgem

Posted at

エラー画面を見やすくするgemを導入する

group :development, :test do
  gem 'better_errors'
  gem 'binding_of_caller'
end

$ bundle install

導入前

スクリーンショット 2020-09-15 18.24.16.png

導入後

スクリーンショット 2020-09-15 18.28.47.png

Application Frames
ここでは、自分の書いたコードを対象にエラーに関係する箇所を明示してくれています

All Frames
自分が書いた箇所以外(gemやActiveSupportなど)まで踏み込んでエラーに関係する箇所が表示されます

ローカルホスト以外のIPを許可

このままではlocalhostからのアクセスにしか対応していない。
他の開発環境でも実行できるようにするには、許可するIPの設定をしなければならない。

config/emvironments/development.rb

Rails.application.configure do
.
.
.
end

 # endの外に以下を追記
BetterErrors::Middleware.allow_ip! "0.0.0.0/0"

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1