Help us understand the problem. What is going on with this article?

Padrino で Better Errors を使う

More than 5 years have passed since last update.

better_errors は sinatra でも使えるので、何も難しいことはないですね。

$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]
$ padrino -v
Padrino v. 0.10.7

サクッと Gemfile に追加して…

Gemfile
group :development do
  gem "better_errors"
  gem "binding_of_caller"
end
$ bundle install

パパッと設定を書いて上げれば…

config/boot.rb
# …
# Load our dependencies
equire 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, PADRINO_ENV)

# ココを追加
if Padrino.env == :development
  Padrino::Application.use BetterErrors::Middleware
  BetterErrors.application_root = PADRINO_ROOT
  BetterErrors.logger = Padrino.logger
  # 表示を許可するアクセス元 IPの指定
  # thanks! @dayflower
  # BetterErrors::Middleware.allow_ip! "127.0.0.0/8" # default
  # BetterErrors::Middleware.allow_ip! "::1/128"     # default
end

##
# ## Enable devel logging
#
# ...

リッチなエラーページが Padrino にもやってきて便利ですね!

追記:
Padrino 0.11 では protect_from_csrf が有効になっているため、
画面右側の情報が何も表示されなくなってしまっています。
どうやって解消すればいいかな…

回避方法を書いてみました。Padrino 0.11 以降で Better Errors を使う

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away