From c9157e9132a97c5ce7d25e509fe407655fc13806 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 5 Aug 2020 14:50:54 +0800 Subject: [PATCH] fix error --- app/models/venue_management_contract.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/venue_management_contract.rb b/app/models/venue_management_contract.rb index af1fdac..3f0d680 100644 --- a/app/models/venue_management_contract.rb +++ b/app/models/venue_management_contract.rb @@ -55,7 +55,7 @@ class VenueManagementContract belongs_to :venue_management_inviting include VenueLinkFile before_save do - org_contract = VenueManagementContract.find(self.id) + org_contract = VenueManagementContract.find(self.id) rescue nil inviting = VenueManagementInviting.find(self.venue_management_inviting_id) rescue nil if !inviting.nil? %i(case_no publish_times start_date end_date close_date bid_date evaluation_date contractor_manager bid_result details).each do |attr_| @@ -65,7 +65,7 @@ class VenueManagementContract self[:case_no] = nil end update_flag = true - if org_contract.venue_management_inviting_id == self.venue_management_inviting_id + if !org_contract.nil? && org_contract.venue_management_inviting_id == self.venue_management_inviting_id %i(early_rent operation_rent royalty house_tax_payer land_tax_payer).each do |attr_| if self[attr_] != (inviting.send(attr_) rescue nil) update_flag = false