it can somehow happen that a person has no profile. somehow. idk why.

This commit is contained in:
MrZYX 2011-02-13 19:29:04 +01:00
parent 86cc7a0d35
commit 20e1316491
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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