From abeba76f4052e54b8977b835f7a77bcad2903da1 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sat, 4 Dec 2010 11:00:58 -0800 Subject: [PATCH] [#4803] Reload the Journal details when showing the deliverable name This caused an odd bug that occurred in Postgres. What would happen is that the first call would find the Deliverable correctly and set the value/old_value on the Journal. But on the second call, the Journal would have the Deliverable subjects in the value and old_value (as string), which would cause Postgres to error since it won't allow searching id (int) with the subject (string). MySQL and SQLite worked because the finder would run but return nil and the next statements are guarded against nils. --- .../hooks/helper_issues_show_detail_after_setting_hook.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/redmine_contracts/hooks/helper_issues_show_detail_after_setting_hook.rb b/lib/redmine_contracts/hooks/helper_issues_show_detail_after_setting_hook.rb index 8e6d74e..d3af4c8 100644 --- a/lib/redmine_contracts/hooks/helper_issues_show_detail_after_setting_hook.rb +++ b/lib/redmine_contracts/hooks/helper_issues_show_detail_after_setting_hook.rb @@ -10,6 +10,8 @@ module RedmineContracts def helper_issues_show_detail_after_setting(context = { }) # TODO Later: Overwritting the caller is bad juju if context[:detail].prop_key == 'deliverable_id' + context[:detail].reload + d = Deliverable.find_by_id(context[:detail].value) context[:detail].value = d.title if d.present? && d.title.present?