2012-02-17 34 views
1

我收到我的日誌中的以下錯誤:::的ActionView TemplateError(未定義的方法'名稱「的零:NilClass)

::的ActionView TemplateError(未定義的方法'名稱」的零:NilClass)上線#18的應用程序/視圖/告示/ _nsv_data.html.erb的:

代碼:

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

,我正在努力過程中的數據是:

處理NoticesController#更新(爲155.70.39.45在2012-02-16 14時21分39秒)[PUT] 會話ID:c5af3ddbc05df2759e9824d62398aab2 參數:{ 「提交」=> 「更新」, 「other_system」=> {「name」=>「」},「notice」=> {「closed_at(4i)」=>「」,「internal」=>「0」,「severity」=>「3」,「resolution」=> 「」, 「isc_ticket_id」=> 「」, 「will_call_code」=> 「」, 「closed_at(5I)」=> 「」, 「ima_table_override」=> 「0」, 「調查」=> 「0」,「will_call_at (1i)「=>」「,」closed「=>」0「,」onset(1i)「=>」2011「,」will_call_at(2i)「=>」「,」region_ids「=> [」4「 ],「開始(2i)」=>「12」,「estimated_resolution(1i)」=>「2012」,「description」=>「當線路移植具有HSI時,列表可能不遷移(ACT = Z和REQTYP = HB) 。 「 」severity_reason「=>」 的功能性損失最小 「 」will_call_at的(3R)「=> 」「, 」TICKET_ID「=> 」5352829「, 」發病的(3R)「=> 」12「,」 estimated_resolution( 2i)「=>」3「,」解決方法「=>」提供商應驗證所有已遷移的列表succ通過月度驗證證明報告或DLIS精心打造。如果您確定列表尚未遷移,並且與HSI移植的TN相關聯,請聯繫您的上市客戶經理尋求幫助。「,」closed_at(1i)「=>」「,」onset(4i)「=>」09「 「estimated_resolution的(3R)」=> 「17」, 「will_call_at(4I)」=> 「」, 「will_call_at(5I)」=> 「」, 「closed_at(2I)」=> 「」,「發病(5I ) 「=>」 07" , 「event_error_msg」=> 「」, 「estimated_resolution(4I)」=> 「」, 「closed_at的(3R)」=> 「」, 「new_document_attributes」=> [{ 「uploaded_document」=> #}],「escalation」=>「」,「impact」=>「當線路移植具有HSI時,列表可能不會遷移(ACT = Z和REQTYP = CB)。」,「estimated_resolution(5i)」=>「」} , 「動作」=> 「更新」, 「_method」=> 「放」, 「authenticity_token」=> 「2c84900beb41fec0fda516b6f022c975fb37148c」, 「系統」=> [{ 「ID」=> 「1」},{ 「ID」= >「7」}],「id」=>「1554」,「controller」=>「notices」} 佈局/主要渲染模板 渲染通知/編輯

+0

nsv_data是如何填充的?因爲顯然nsv_data.other_system是空的。 – 2012-02-17 00:43:24

+0

當您提交表單時,您傳遞兩個不同的哈希值,另一個哈希值是other_system。你是否將控制器中的其他系統分配給nsv_date? – 2012-02-17 01:31:18

回答

0

只需添加sys.try(:name)。您可能也想檢查this

+0

我做了以下: 其他<%= text_field_tag 「other_system [名稱]」,nsv_data.other_system.try(:名稱)%> 現在我接收到以下錯誤: ::的ActionView TemplateError(NoMethodError )上線#應用程序/視圖/告示/ _nsv_data.html.erb的18: – user1215118 2012-02-17 19:08:11

+0

奇怪如果刪除它然後正常工作:​​ \t \t \t <%= check_box_tag 「has_other」,1,nsv_data.has_other_system? %> \t \t \t其他<%= text_field_tag 「other_system [名稱]」,nsv_data.other_system.try(:名稱)%> \t \t – user1215118 2012-02-17 19:43:25

0

這是與數據庫中的一個問題,我只是重新部署數據庫,這是固定的,這意味着代碼是很好。

但是非常感謝你的幫助:)

相關問題