web analytics
Contact me 
Orange D inside a circle

Better Errors & RailsPanel: development aids

2014-09-29 01:05

Here we take a look at two tools to aid us in Ruby on Rails development process.

Better Errors

The default Rails error page is completely hideous and hurts to look at. Better Errors replaces the standard Rails error page with a much better and more useful error page.

This is how the "Better Errors" error page looks:

Better Errors interface sample

It is clearly more visually appealing, but it also provides much more detailed debug information (also the error page page is even responsive!).

Intalling the gem is very easy. You just have to add the following to your gemfile:

group :development do
  gem "better_errors"
end

Better errors has an optional dependency to another gem. If you add the binding_of_caller gem to the gemfile then you could use Better Errors' advanced features (REPL, local/instance variable inspection, pretty stack frame names).

If you are debugging a Rails API, AJAX, want to investigate a non-critical error like missing images, better_errors provides a page accessible via the url "/__better_errors" which contains the error page for the last error on the server. Another awesome part of better_errors is that it can open up files in your editor! Out-of-the-box it support textmate, vim, etc. but if you are like us and enjoy using Sublime Text, you have to download sublime-handler. Then you have to configure an initializer for better_errors like this:

BetterErrors.editor = :sublime if defined? BetterErrors

Remember to add Better Errors gem inside a :development section. Do NOT run better_errors in production, or on Internet facing hosts.

RailsPanel

RailsPanel is a Chrome extension for Rails development that will end your tailing of development.log. Have all information about your Rails app requests in the browser - in the Developer Tools panel. Provides insight to db/rendering/total times, parameter list, rendered views and more.

RailsPanel Screenshot

The installation is as simple as going to the Chrome WebStore and install RailsPanel extension from there. This is recommended way of installing extension, since it will auto-update on every new version. Then you have to add this to the gemfile:

group :development do
  gem 'meta_request'
end

You can even choose your editor on the extension options page: chrome://extensions. Following editors are supported:

  • MacVim
  • TextMate
  • Sublime
  • Emacs
  • RubyMine

Better Errors & RailsPanel RailsCasts

If you want to see both in action and learn a bit more about each of them, don't miss this RailsCasts!

Acknowledgments

This post was written for Vairix Software Development, so I want say thanks to them for let me share this with you in my homepage.


Significant Revisions

Sep 29, 2014: Original Publication on dariomac.com

Dic 10, 2014: Original Publication on dariomac.com