1
votes

I'm receiving the following error on my log:

ActionView::TemplateError (undefined method `name' for nil:NilClass) on line #18 of app/views/notices/_nsv_data.html.erb:

The code:

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

The data which I'm trying to process is:

Processing NoticesController#update (for 155.70.39.45 at 2012-02-16 14:21:39) [PUT] Session ID: c5af3ddbc05df2759e9824d62398aab2 Parameters: {"commit"=>"Update", "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", "investigation"=>"0", "will_call_at(1i)"=>"", "closed"=>"0", "onset(1i)"=>"2011", "will_call_at(2i)"=>"", "region_ids"=>["4"], "onset(2i)"=>"12", "estimated_resolution(1i)"=>"2012", "description"=>"Listings may not migrate (ACT=Z and REQTYP=HB) when line porting has HSI.", "severity_reason"=>"Minimal loss of functionality", "will_call_at(3i)"=>"", "ticket_id"=>"5352829", "onset(3i)"=>"12", "estimated_resolution(2i)"=>"3", "workaround"=>"Providers should validate all listings have migrated successfully via the monthly Verification Proof report, or DLIS. If you determine a listing has not migrated and was associated with a ported TN with HSI, contact your Listing Account Manager for assistance.", "closed_at(1i)"=>"", "onset(4i)"=>"09", "estimated_resolution(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"=>"Listings may not migrate (ACT=Z and REQTYP=CB) when line porting has HSI.", "estimated_resolution(5i)"=>""}, "action"=>"update", "_method"=>"put", "authenticity_token"=>"2c84900beb41fec0fda516b6f022c975fb37148c", "systems"=>[{"id"=>"1"}, {"id"=>"7"}], "id"=>"1554", "controller"=>"notices"} Rendering template within layouts/main Rendering notices/edit

2
How is nsv_data populated? Because obviously nsv_data.other_system is null. - Marc Talbot
When you are submitting your form you are passing two different hashes one notice and another one is other_system. Are you assigning other_system to nsv_date in your controller? - Ajay Kumar Guthikonda

2 Answers

0
votes

Just add sys.try(:name). You might want to check this out too.

0
votes

It was an issue with the database, I just redeployed the database and It was fixed, which means the code is well.

However thank you so much for try to help :)