a bad fix for a 500 on notification show when the post is deleted

This commit is contained in:
maxwell 2010-12-21 12:54:19 -08:00
parent 0da4466da2
commit c2c6c00db8
2 changed files with 7 additions and 1 deletions

View file

@ -8,7 +8,12 @@ module NotificationsHelper
when 'new_request'
translation
when 'comment_on_post'
"#{translation} #{link_to t('notifications.post'), object_path(Comment.first(:id => note.target_id).post)}".html_safe
comment = Comment.first(:id => note.target_id)
if comment
"#{translation} #{link_to t('notifications.post'), object_path(comment.post)}".html_safe
else
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
end
else
end
end

View file

@ -188,6 +188,7 @@ en:
new_request: "offered to share with you."
comment_on_post: "commented on your"
post: 'post'
deleted: 'deleted'
index:
notifications: "Notifications"
users: