user display changes in model and mailer

This commit is contained in:
wvengen 2013-09-22 14:38:56 +02:00
parent f6c2fd9a9d
commit ea3db22306
4 changed files with 23 additions and 9 deletions

View file

@ -158,8 +158,17 @@ class User < ActiveRecord::Base
end
end
# 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 : "#{first_name} #{last_name}"
end
def token_attributes
{:id => id, :name => "#{nick} (#{ordergroup.try(:name)})"}
# would be sensible to match ApplicationController#show_user
# this should not be part of the model anyway
{:id => id, :name => "#{display} (#{ordergroup.try(:name)})"}
end
end