[#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.
This commit is contained in:
Eric Davis
2010-12-04 11:00:58 -08:00
parent 726c7a206f
commit abeba76f40

View File

@@ -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?