添加判空

This commit is contained in:
lizanle 2015-04-15 10:52:10 +08:00
parent c2ccf6a1f8
commit c42a63ea4e
1 changed files with 2 additions and 2 deletions

View File

@ -15,13 +15,13 @@ module Mobile
when :img_url
url_to_avatar(u)
when :gender
u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender
u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender
when :work_unit
get_user_work_unit u
when :location
get_user_location u
when :brief_introduction
u.user_extensions.brief_introduction
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction
end
end
end