プロジェクト

全般

プロフィール

Vote #65554

完了

Custom Values with a nil value cause HTTP error 500

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
高め
担当者:
-
カテゴリ:
Custom fields_14
対象バージョン:
開始日:
2009/08/02
期日:
進捗率:

0%

予定工数:
category_id:
14
version_id:
12
issue_org_id:
3705
author_id:
2207
assigned_to_id:
0
comments:
3
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
10
ステータス-->[Closed]

説明

I recently upgraded my Redmine installation from r2264 to r2835. The upgrade and database migration went without a hitch.

However, most - but not all - of my project pages stopped working. The log states:

bc. ActionView::TemplateError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?) on line #12 of app/views/projects/show.rhtml:
9: <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %>
10: <% end %>
11: <% @project.custom_values.each do |custom_value| %>
12: <% if !custom_value.value.empty? %>
13:

  • <%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %>

  • 14: <% end %>
    15: <% end %>

    Digging into my data it appears that all the Projects whose page have stopped working have a bunch of CustomFields with a value of nil:

    bc. >> Project.first.custom_values
    => [#, #]

    Both of those custom fields appear to have been added by the Redmine Hoptoad Server plugin at http://github.com/yeah/redmine_hoptoad_server/tree/master.

    Anyways, seeing as there are no validations in RedMine on CustomValue preventing nil-values from being stored in the database, the projects/show.rhtml view is making unsafe assumptions. The attached patch adds a safeguard for the assumption.

    The patch also fixes the issue reported in http://www.redmine.org/boards/2/topics/5872, which is basically the same issue as this.


    journals

    If you, as a Redmine user, want to work around this issue, the following method appears to be working:

    1. Go to your Project administration area under Administration > Projects
    2. Visit each project that has the above issue.
    3. Click "Save".

    This should fix the above issue (by replacing the nil-values with empty strings).
    --------------------------------------------------------------------------------
    Fixed in r2894. Thanks.
    --------------------------------------------------------------------------------
    Merged in 0.8-stable in r2996.
    --------------------------------------------------------------------------------

    Admin Redmine さんが3年以上前に更新

    • カテゴリCustom fields_14 にセット
    • 対象バージョン0.8.6_12 にセット

    他の形式にエクスポート: Atom PDF

    いいね!0
    いいね!0