0
如何连接first_name
和last_name
并在full_name
中添加honorific_prefix
如果它不为空?在视图中连接字符串
defmodule MyApp.UserView do
use MyApp.Web, :view
alias MyApp.User
def full_name(%User{first_name: first_name,
last_name: last_name,
honorific_prefix: honorific_prefix}) do
first_name
|> String.upcase
end
end