【发布时间】:2012-03-08 10:34:30
【问题描述】:
我在日志中收到以下错误:
app/views/notices/_nsv_data.html.erb 第 18 行的 ActionView::TemplateError(nil:NilClass 的未定义方法“名称”):
代码:
<table border="0" cellspacing="0" cellpadding="0">
<% System.get_systems_in_display_order.each do |sys| -%>
<tr>
<td>
<%= check_box_tag "systems[][id]", sys.id, nsv_data.has_system?(sys.id) %>
<%= sys.name %>
<% if sys.can_has_version? -%>
<br/>
<% options = options_for_select( sys.get_system_version_select_options, nsv_data.system_version_ids( sys.id ) ) -%>
<%= select_tag "system_versions[#{sys.id}]", options, { :multiple => true, :size => 5, :id => "system__versions", :class => "system__box" } %>
<% end -%>
</td>
</tr>
<% end -%>
<tr>
<td>
<%= check_box_tag "has_other", 1, nsv_data.has_other_system? %>
Other <%= text_field_tag "other_system[name]", nsv_data.other_system.name %>
</td>
</tr>
我要处理的数据是:
Processing NoticesController#update (for 155.70.39.45 at 2012-02-16 14:21:39) [PUT] 会话 ID:c5af3ddbc05df2759e9824d62398aab2 参数:{"commit"=>"Update", "other_system"=>{"name"=>""}, "notice"=>{"closed_at(4i)"=>"", "internal"=>" 0", "严重性"=>"3", "分辨率"=>"", "isc_ticket_id"=>"", "will_call_code"=>"", "closed_at(5i)"=>"", "ima_table_override" =>“0”,“调查”=>“0”,“will_call_at(1i)”=>“”,“关闭”=>“0”,“开始(1i)”=>“2011”,“will_call_at( 2i)"=>"", "region_ids"=>["4"], "onset(2i)"=>"12", "estimated_resolution(1i)"=>"2012", "description"=>"列表当线路移植具有 HSI 时,可能无法迁移(ACT=Z 和 REQTYP=HB)。", "severity_reason"=>"最小的功能损失", "will_call_at(3i)"=>"", "ticket_id"=>"5352829 ", "onset(3i)"=>"12", "estimated_resolution(2i)"=>"3", "workaround"=>"提供商应通过每月验证证明报告或 DLIS 验证所有列表是否已成功迁移。如果您确定列表尚未迁移并且与 HSI 移植的 TN 相关联,请联系您的列表客户经理寻求帮助。", "closed_at(1i)"=>"", "onset(4i)"=>"09" , "估计的分辨率tion(3i)"=>"17", "will_call_at(4i)"=>"", "will_call_at(5i)"=>"", "closed_at(2i)"=>"", "onset(5i)" =>"07", "event_error_msg"=>"", "estimated_resolution(4i)"=>"", "closed_at(3i)"=>"", "new_document_attributes"=>[{"uploaded_document"=>#} ], "escalation"=>"", "impact"=>"当线路移植有 HSI 时,列表可能不会迁移(ACT=Z 和 REQTYP=CB)。", "estimated_resolution(5i)"=>""}, " action"=>"update", "_method"=>"put", "authenticity_token"=>"2c84900beb41fec0fda516b6f022c975fb37148c", "systems"=>[{"id"=>"1"}, {"id"=>" 7"}], "id"=>"1554", "控制器"=>"通知"} 在 layouts/main 中渲染模板 渲染通知/编辑
【问题讨论】:
-
nsv_data 是如何填充的?因为显然 nsv_data.other_system 为空。
-
当您提交表单时,您传递了两个不同的哈希值,一个是通知,另一个是 other_system。您是否在控制器中将 other_system 分配给 nsv_date?
标签: ruby-on-rails ruby ruby-on-rails-3 rubygems