app/views/favorites/index.html.erb
<%= title("Favorites") %>
<%= current_user.name %>
<div class="results row">
<div class="span6">
<h4> You have favorited the followings listings </h4>
</div>
<div class="reset-btn pull-right">
<%= link_to "Clear favorites list", favorites_properties_path, class: "btn btn-small btn-danger", method: :delete %>
</div>
</div>
<table class="table table-hover table-striped">
<thead>
<th> Image </th>
<th> Description </th>
<th> Address </th>
<th> Price </th>
<th> Days on Market </th>
</head>
<tbody>
<% @properties.each do |property| %>
<tr>
<td><%= image_tag thumbnail(property, :small) %> </td>
<td><%= property.title %></td>
<td><%= property.street %> </td>
<td><%= property.price %> </td>
<td><%= (Date.today - property.created_at.to_date).to_i %>
<td><%= link_to 'View', property_path(property) %></td>
<td><%= link_to 'Remove from favorites',
favorites_properties_path(id: property),
method: 'put', confirm: 'Are you sure you want to remove this property from your favorites' %>
</td>
<td><%= link_to "Compare it", compare_properties_path(id: property), method: 'post' %></td>
</tr>
<% end %>
</tbody>
</table>