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.

If you enjoyed this and would like to be notified the next time I write something, you can subscribe with your choice of RSS or Email.

I promise not to spam you and you can unsubscribe at anytime.

Also, here are some other items you might like longer longer:

or go see everything in the archive.