Useful Gems for Web Dev

Try out gems by adding the following two Gems to your project workflow.

These gems will give you richer feedback on what happens when things go wrong with your Sinatra projects.

better_errors

Better error page for Rack apps. Available at: https://github.com/charliesome/better_errors

The error codes generated when something went wrong with the Ruby code contains valuable information. However, they are often covered in a large number of lines and hides the most valuable information. Better_Errors make it easier for developers to find their issues by decoding the cryptic error message in a user friendly way.

Just pop this in your Gemfile

group :development do
  gem "better_errors"
end

and this in your app.rb to get much nicer errors

require "better_errors" if development?

configure :development do
  use BetterErrors::Middleware
  BetterErrors.application_root = __dir__
end

P.S. You’ll need to stop and start your server for it to work.

did_you_mean

The gem that has been saving people from typos since 2014. Available at: https://github.com/yuki24/did_you_mean

For beginners in Ruby, nuances in syntax is hard to distinguish and misspelling is also annoying. Sometimes a misspelled word leads to hours of troubleshooting. To solve problems as such, a gem called Did_you_mean could be an efficient tool for beginners by providing suggestions on error messages. Created by Yuki Nishijima, the gem features in providing instant feedback for spelling errors in method name, class name, variable name, and more.

In your Gemfile:

group :development do
  gem "did_you_mean"
end

and this in your app.rb to get much nicer errors

require "did_you_mean" if development?
×

Subscribe

The latest tutorials sent straight to your inbox.