Josh W Lewis

Josh W Lewis

/

Essays

/

Categories

/

rails

Rails Unit Measurement Persistence

By Josh on March 9, 2014

I’ve worked on a few apps in the past that had some cumbersome constraints in regards to the units of measurement. Models needed to store heat transfer or fluid dynamics properties in either english or SI units. This is can be a bit of a pain, so I...

Rails' ActiveSupport try

By Josh on April 26, 2013

ActiveSupport has a few great Ruby extensions that I just love. One of my favorites is try.

.try()

Try is a sneaky method for handling NoMethodErrors on NilClass. If you ever get stuck writing code like this:

name = user.name unless user.nil?

Consider...

Rails Flash Messages with Twitter Bootstrap

By Josh on March 2, 2013

When building new Rails projects, I often use Bootstrap because it lets me focus more on the business logic, rather than design. Almost everytime I start one of these projects, I forget how I did flash messages the last time, and have to look at a...