Forum: Ruby on Rails auto_link generating error (nil.gsub) in functional test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sean H. (Guest)
on 2006-01-11 00:11
(Received via mailing list)
Hi everyone,

When running tests, I get this error for running auto_link on a set of
column data:

ActionView::TemplateError: You have a nil object when you didn't expect
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
    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?


This topic is locked and can not be replied to.