command line connoisseur
Image for post
Image for post

This article explores the interaction between four different Ruby web servers and their respective Rack handlers. The servers being the famous Webrick, Mongrel, Thin and Puma.

The idea is to use these servers to GET a Hello, World! at /, both on and off Rack. The goal is to make it clearer why Rack was created in the first place, and why to this day it’s still so relevant.

Getting Ready

The examples to come will help to illustrate the role that Rack, specially the Rack::Handler, plays on being that minimal interface between Ruby web servers and Ruby web frameworks, as stated by Rack documentation. …


7 techniques to increase the developer’s experience during a Rails console session

Image for post
Image for post
Photo by Sergi Viladesau on Unsplash

Please note that some of these will come from Ruby itself, and thus won’t be necessarily restricted to the console.

1. Rolling Back After the End of a Session

It is possible to run the console in a mode called sandbox. In that mode, every change made to the database will be automatically rolled back when the session terminates:

$ rails console --sandbox

2. Retrieving the Previous Execution Value

The result of the immediately previous console execution can be retrieved and, as the example suggests, assigned to a local variable by calling the _:

>> Game.all.map(&:name)
=> ["zelda", "mario", "gta"]
>> names = _
=> ["zelda", "mario", "gta"]

3. Searching for Methods With grep

It is possible to find out the complete name of a method having only a part of it. By calling grep from Array, one can execute a handy search over the methods of a given…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store