Rails' Active Support provides the
methods as extensions to many objects. It also extends the Object class by
method. This method returns the receiver if it is not blank, otherwise
it returns nil.
Instead of doing
User.nickname.present? ? User.nickname : User.firstname
I can simply do
User.nickname.presence || User.firstname