You can avoid the nil check using `bookmark.category.try(:capitalize)`. [See docs here](http://apidock.com/rails/Object/try)