プロジェクト

全般

プロフィール

Vote #69236

完了

ActionView::TemplateError (undefined method `name' for nil:NilClass)

Admin Redmine さんがほぼ2年前に追加. ほぼ2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2011/02/11
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
27
issue_org_id:
7604
author_id:
28277
assigned_to_id:
0
comments:
1
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
20
ステータス-->[Closed]

説明

My school (Regis Jesuit High School) is using Redmine to manage our newsroom publication workflow. It's super useful, but I keep getting an error when submitting edits to certain issues.

Error:

Processing IssuesController#update (for 174.253.181.218 at 2011-02-10 17:44:42) [PUT]  Parameters: {"time_entry"=>{"comments"=>"", "activity_id"=>"", "hours"=>""}, "commit"=>"Submit", "notes"=>"hello", "action"=>"update", "_method"=>"put", "authenticity_token"=>"D0eCFy/UxVBiZvKK0db3OwQacDvMpuAwprt+q8P2JpE=", "id"=>"100", "issue"=>{"start_date"=>"2011-02-09", "estimated_hours"=>"", "priority_id"=>"4", "parent_issue_id"=>"", "lock_version"=>"4", "fixed_version_id"=>"6", "done_ratio"=>"0", "assigned_to_id"=>"1", "subject"=>"Minecraft Feature Spread", "tracker_id"=>"21", "due_date"=>"", "status_id"=>"7", "description"=>"This spread will be a
 look into the wondrous world of Minecraft as well as some of the guys who play 
it at RJ.\r\n\r\nMinecraft is a very cool game that is much like building a model train set: only a few people appreciate those who play it and the rest think i
t's a complete waste of time.\r\n\r\nHowever, people have made some pretty aweso
me worlds with Minecraft, including the social media platform Reddit, whose play
ers have built things like the Golden Gate bridge and the Statue of Liberty, som
etimes to scale.\r\n\r\nAlthough it seems like a creativity tool only, Minecraft adds the twist of monsters that come out at night and attack the player, making
 it a combination of creativity and tower defense."}, "controller"=>"issues", "a
ttachments"=>{"1"=>{"description"=>""}}}

ActionView::TemplateError (undefined method `name' for nil:NilClass) on line #10
 of app/views/mailer/_issue_text_plain.rhtml:7: <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
8: <%=l(:field_category)%>: <%= issue.category %>
9: <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
10: <% issue.custom_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>
11: <% end %>
12: 
13: <%= issue.description %>

    app/views/mailer/_issue_text_plain.rhtml:10:in `_run_rhtml_app47views47mailer47_issue_text_plain46rhtml_locals_issue_issue_text_plain_issue_url_object'
    app/views/mailer/_issue_text_plain.rhtml:10:in `_run_rhtml_app47views47mailer47_issue_text_plain46rhtml_locals_issue_issue_text_plain_issue_url_object'
    app/views/mailer/issue_edit.text.plain.rhtml:9:in `_run_rhtml_app47views47mailer47issue_edit46text46plain46rhtml'
    app/models/mailer.rb:398:in `render_multipart'
    app/models/mailer.rb:79:in `issue_edit'
    app/models/journal_observer.rb:24:in `after_create'
    /usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'
    /usr/lib/ruby/1.8/observer.rb:184:in `each'
    /usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'
    app/models/journal.rb:43:in `save'
    app/models/issue.rb:848:in `create_journal'    app/models/issue.rb:554:in `save_issue_with_child_records'
    app/models/issue.rb:536:in `save_issue_with_child_records'    app/controllers/issues_controller.rb:170:in `update'
    passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in 
`main_loop'    passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in
 `start_request_handler'    passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:381:in
 `handle_spawn_application'    passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork'
    passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in `start'
    passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /etc/redmine/public/500.html (500 Internal Server Error)

I actually did manage to fix this one by adding two or three lines of code in app/views/mailer/_issue_text_plain.rhtml and app/views/mailer/_issue_text_html.rhtml:

_issue_text_plain.rhtml

Find:

<% issue.custom_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>

Replace with:

<% issue.custom_values.each do |c| %>
<% unless c.nil? || c.custom_field.nil? %>
<%= c.custom_field.name %>: <%= show_value(c) %>
<% end %>

_issue_text_html.rhtml

Find:

<% issue.custom_values.each do |c| %>
  
  • <%=h c.custom_field.name %>: <%=h show_value(c) %>
  • <% end %>

    Replace with:

    <% issue.custom_values.each do |c| %>
      <% unless c.nil? || c.custom_field.nil? %>
      
  • <%=h c.custom_field.name %>: <%=h show_value(c) %>
  • <% end %> <% end %>

    Apparently one of the custom fields for an issue can be nil? Why exactly is this? I'll admit, my fix is kind of a kludge but does the job nicely...

    Environment Info

    About your application's environment
    Ruby version              1.8.7 (i686-linux)
    RubyGems version          1.3.7
    Rack version              1.0
    Rails version             2.3.5
    Active Record version     2.3.5
    Active Resource version   2.3.5
    Action Mailer version     2.3.5
    Active Support version    2.3.5
    Application root          /etc/redmine
    Environment               production
    Database adapter          mysql
    Database schema version   20101115203855
    
    About your Redmine plugins
    Redmine Wiki Extensions plugin                   0.2.4
    Redmine Whining plugin                           0.0.4
    Redmine User Profiles plugin                     0.0.2
    Redmine Ultraviolet Syntax highlighting plugin   0.0.3
    Redmine JChat                                    0.2.0
    Redmine Theme Changer plugin                     0.0.2
    Redmine ICalendar Export Plugin (aka redmics)    1.1
    

    Other Info

    Redmine Version: 1.1.1 SVN
    MySQL Version: mysql  Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i686) using readline 6.1
    

    Thanks!


    journals

    r4891 and r4892 should fix the problem.
    --------------------------------------------------------------------------------

    Admin Redmine さんがほぼ2年前に更新

    • カテゴリIssues_2 にセット
    • 対象バージョン1.2.0_27 にセット

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

    いいね!0
    いいね!0