add some nil checks
authorTom Clegg <tom@clinicalfuture.com>
Mon, 4 Feb 2013 06:57:40 +0000 (22:57 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 4 Feb 2013 07:00:30 +0000 (23:00 -0800)
app/views/collections/index.html.erb

index cb5db8a9e0de5f521106fc457eae169c47609d02..8dc4570ddfe3b7f1eee5f8d4c48af115e82d163f 100644 (file)
   </thead>
   <tbody>
 
-    <% @collections.values.sort_by { |c| c[:created_at] }.reverse.each do |c| %>
+    <% @collections.values.sort_by { |c| c[:created_at] || Time.now }.reverse.each do |c| %>
 
     <tr class="collection">
       <td>
        <%= c[:uuid] %>
       </td><td>
-       <%= distance_of_time_in_words(c[:created_at], Time.now).sub('about ','~').sub(' ','&nbsp;') if c[:created_at] %>
+       <%= raw(distance_of_time_in_words(c[:created_at], Time.now).sub('about ','~').sub(' ','&nbsp;')) if c[:created_at] %>
       </td><td>
        <%= ('Y' if c[:wanted_by_me]) or ('y' if c[:wanted]) %>
       </td><td>