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
|
def index
|
||||||
@thing = Thing.find_by_id(params[:thing_id])
|
@thing = Thing.find_by_id(params[:thing_id])
|
||||||
if @thing.adopted?
|
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")
|
render("users/thank_you")
|
||||||
else
|
else
|
||||||
render("users/profile")
|
render("users/profile")
|
||||||
|
|
|
@ -57,6 +57,6 @@ class Thing < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def adopted?
|
def adopted?
|
||||||
!user_id.nil?
|
!user.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue