From ac00942f3488cc3e6892864c36f9f119b54bc008 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Tue, 26 Sep 2017 13:13:20 +0200 Subject: [PATCH] Fix list of invoices when an invoice has an invalid created_by user --- app/models/invoice.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 1fc943e7..b5594e64 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -30,7 +30,7 @@ class Invoice < ActiveRecord::Base end def user_can_edit?(user) - user.role_finance? || (user.role_invoices? && !self.paid_on && self.created_by.id == user.id) + user.role_finance? || (user.role_invoices? && !self.paid_on && self.created_by.try(:id) == user.id) end # Amount without deposit