Advanced Rails Routing Constraints

One of the parts of the Rail’s stack that always seemed to confuse me was the routing. Once you go beyond the simple resource routing unless you have a bit more under you’re belt reading and writing routes can be daunting. I would like to go over just a couple items that I’ve picked up which may prove helpful for others who need to go beyond the vanilla route schemes.

URI Case Sensitivity

In case you ever run into a problem where you are wondering if urls are case sensitive or not here is a couple things you’ll want to keep in mind. First the host and scheme are NOT case sensitive. This means the following list are all valid.


After the host all non-encoded characters are considered to be case sensitive. This means that if you decide to treat all of the following as the same route you may want to redirect the requests preferably to the lower case version.

If you have encoded characters, those are not case sensitive. To explain, if you see a url that looks like this: übber

It will be encoded into the following by the browser:
%20 = (space)
%G%C3%BC = ü

These “percent encoded” characters are not case sensitive, so these are to be considered equal.


Thanks to Everyone Around Me

I want to thank everyone who has helped me these last few weeks. I have been staring at some hard choices to make in my life and have had a ton of support in being able to make the best decision for my family and myself. I am very lucky be surrounded by so many great people.

Code: The Hidden Language of Computer Hardware and Software

Several weeks ago a good friend of mine told me about the book Code: The Hidden Language of Computer Hardware and Software. I picked it up for the Kindle and could not put it down! It does an awesome job of explaining the basics of computers by first explaining some of the early forms of binary communication such as Morse code and Braille. Then it dips into a small aside on how electricity works and begins to describe how you can build different kinds of logic gates with relays.

Ruby and the Repository Pattern

Something you will notice after working with a Rails application for any amount of time is that it’s easy for your models to get bloated with business logic. ActiveRecord makes it very easy to chuck in non-essential model ideas, such as complex model validation and callbacks. For a small Rails project this isn’t a problem; however, as it begins to grow and your models need to change in the context you’re using them this is when you run into problems.

Setting Up for Failure

A bad system will beat a good person every time

— W. Edwards Deming

Perhaps one of the most perplexing things in the workplace is to find talented developers failing to accomplish the goals set forth in front of them. This becomes even more mysterious when they have had a past track record of being very successful. How does this happen? There are perhaps an uncountable amount of reasons this happens; however, I would like to cover several scenarios I have noticed over the years that seem to breed this behavior.

Who Can Predict the Future?

One of the most tempting; but often the most dangerous things we do as software developers is predict our software will change in a specific way. Always stop and challenge any extra code you create. Are you writing this to solve the problem you have today? Are you writing this to solve the problem you may have in the future?

Ruby Inheritance With Super

A couple days ago during a code review one of my coworkers noticed that we called the super method with no parameters and still had parenthesis. They wanted to remove it; however, it turns out in Ruby that super does some extra magic that you need to be careful about.

More Curl Per Minute

Today I had to do some advance curling and I though I would share what I did to really get the most out of what I was doing. Essentially I had a huge CSV of values that I wanted to go through and get the status code for. One option possible was to bust out Ruby or Elixir and write some quick software to accomplish the task; but bash once again has come out on top with the one liner that seems to be ideal.