it can somehow happen that a person has no profile. somehow. idk why.
This commit is contained in:
parent
86cc7a0d35
commit
20e1316491
2 changed files with 3 additions and 3 deletions
|
|
@ -148,7 +148,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def person_image_link(person, opts = {})
|
||||
return "" if person.nil?
|
||||
return "" if person.nil? || person.profile.nil?
|
||||
if opts[:to] == :photos
|
||||
link_to person_image_tag(person, opts[:size]), person_photos_path(person)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class Person < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def name(opts = {})
|
||||
@name ||= if profile.first_name.nil? || profile.first_name.blank?
|
||||
@name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank?
|
||||
self.diaspora_handle
|
||||
else
|
||||
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
|
||||
|
|
@ -83,7 +83,7 @@ class Person < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def first_name
|
||||
@first_name ||= if profile.first_name.nil? || profile.first_name.blank?
|
||||
@first_name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank?
|
||||
self.diaspora_handle.split('@').first
|
||||
else
|
||||
profile.first_name.to_s
|
||||
|
|
|
|||
Loading…
Reference in a new issue