I have a Notification model that is associated to a User model through “origin_user”.
I am looking for a shortcut to this:
if notification.origin_user.present?
notification.origin_user.name
else
"a user"
end
Isn’t there magic all-in-one function?
But if youpromise a
User, give aUser. You could rely on the NullObject Design Pattern.