Display An Attribute In Rails Uppercase And Handle Nil

Feb 7, 2014

It may not be obvious, but you can access attributes in Rails through the attributes array. You can use that array to upcase entries and handle nils.

Now anything you through at it, assuming it’s an attribute of the object, will either display in uppercase or rescued with an empty string.