Check whether the user is nil, in case the user has been deleted
This commit is contained in:
parent
4cfa9ad5c7
commit
c12b2fb58a
|
@ -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")
|
||||
|
|
|
@ -57,6 +57,6 @@ class Thing < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def adopted?
|
||||
!user_id.nil?
|
||||
!user.nil?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue