Here is my code in my index view template:
<% @locations.each do |location| %>
<tr>
<td><%= link_to formatted_uwi(location.uwi), location_path(location) %></td>
<td><%= location.name %></td>
<td><%= location.created_at %></td>
<td>
<%= link_to 'Edit', edit_location_path(location), :class => 'btn btn-mini' %>
<%= link_to 'Destroy', location_path(location), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
</td>
</tr>
<% end %>
It runs fine on my local dev system but fails on Heroku in pro & dev environments. I get:
"TypeError... can't convert nil into String"
formatted_uwi
is a simple helper that formats the location.uwi input. If I call just 'location.uwi' or use an actual string in it's place it works fine and displays the raw location.uwi value so I know it's not a nil value. I even tried location.uwi.to_s.
Very bizarre. I can call this helper on the show, edit and other views and it works fine. It only fails in the do loop AND on Heroku.
Not sure what I did but I went back trough my helper to catch the nil and it seems to work now.
What I havn't tried yet is pulling the helper out of the link_to to see if that is part of the problem - Dan Tappin 2012-04-04 16:55