fallback for when nick is nil

This commit is contained in:
wvengen 2013-10-29 18:58:04 +01:00
parent e968919cce
commit 9ba425aafa
6 changed files with 12 additions and 6 deletions

View file

@ -161,8 +161,12 @@ class User < ActiveRecord::Base
# XXX this is view-related; need to move out things like token_attributes
# then this can be removed
def display
# would be sensible to match ApplicationController#show_user
FoodsoftConfig[:use_nick] ? nick : name
# would be sensible to match ApplicationHelper#show_user
if FoodsoftConfig[:use_nick]
nick.nil? ? I18n.t('helpers.application.nick_fallback') : nick
else
name
end
end
def token_attributes