LoginSignup
6

More than 5 years have passed since last update.

nitrous.ioでbetter_errorsを使う

Posted at

導入

better_errorsを入れると、エラー画面をいい感じにしてくれるらしい。
導入方法は

Gemfile
group :development do
  gem "better_errors"
end

これだけ。

現象

やってみたら、エラー画面変わらん!何でや!

原因

READMEちゃんと読もう。

NOTE: It is critical you put better_errors in the development section. Do NOT run better_errors in production, or on Internet facing hosts.

Internet facing hosts.
nitrous.ioで開発しているのが原因でした。

解決方法

config/environments/development.rb
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']

を追記して

TRUSTED_IP=xxx.xxx.xxx.xxx rails s

で起動。

IPアドレスはアクセス情報【使用中のIPアドレス確認】などで確認します。
(ipconfig/ifconfigではプライベートIPアドレスしか分からない可能性あり)

これで見れるようになりました。めでたし。

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
6