Sean Hussey
2006-Jan-10 22:08 UTC
[Rails] auto_link generating error (nil.gsub) in functional test
Hi everyone, When running tests, I get this error for running auto_link on a set of column data: test_list(PersonnelControllerTest): ActionView::TemplateError: You have a nil object when you didn''t expect it! The error occured while evaluating nil.gsub On line #28 of app/views/personnel/list.rhtml 25: <tr valign="top" class="<%= alternate_rows %>"> 26: <% display_columns = ["username", "preferred_name", "email", "title"] %> 27: <% display_columns.each do |column| %> 28: <td><%= auto_link(person.send(column)) %></td> 29: <% end %> 30: <td><%= link_to ''Details'', :action => ''show'', :id => person %></td> 31: </tr> Only one of the pieces of data ends up with a link (the email), so this is probably bad design anyway. How can I handle auto-linking the email address in this situation? Thanks, Sean