Check whether the user is nil, in case the user has been deleted

This commit is contained in:
Erik Michaels-Ober 2013-12-02 23:52:37 +01:00
parent 4cfa9ad5c7
commit c12b2fb58a
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@ class InfoWindowController < ApplicationController
def index
@thing = Thing.find_by_id(params[:thing_id])
if @thing.adopted?
if user_signed_in? && current_user.id == @thing.user_id
if user_signed_in? && current_user == @thing.user
render("users/thank_you")
else
render("users/profile")

View File

@ -57,6 +57,6 @@ class Thing < ActiveRecord::Base
end
def adopted?
!user_id.nil?
!user.nil?
end
end