<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>

<%= cache(cache_key_for_businesses(@businesses)) do %>
  <div class="bus_index_well">
    <table class="table table-hover pretty">
      <thead>
        <tr>
          <th><%= sortable "title" %></th>
          <th><%= sortable "category" %></th>
          <th><%= sortable "rating" %></th>
          <% if can? :manage, @businesses %>
            <th><%= " " %></th>
          <% end%> 
        </tr>
      </thead>
      <tbody>
        <% @businesses.each do |business| %>
          <% cache(business) do %>
            <tr>
              <td>
                <% if business.created_at > 7.days.ago %>
                  <%= link_to business.title, business %> <span class="label label-primary">New</span>
                <% else %>
                  <%= link_to business.title, business %>
                <% end %>
              </td>
              <td><%= business.category %></td>
              <td>
                <%= number_with_precision(business.reviews.average("rating"), :precision => 2 || 0) 
                %>
              </td>
              <% if can? :manage, business %>
                <td><%= link_to "Edit", edit_business_path(business) %></td>
              <% end %> 
            </tr>
          <% end %>
        <% end %>
      </tbody>
    </table>
    <div class="pagination">
      <%= will_paginate @businesses, renderer: BootstrapPagination::Rails %>
    </div>
  </div>
<% end %>

<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>

<%= cache(cache_key_for_businesses(@businesses)) do %>
  <div class="bus_index_well">
    <table class="table table-hover pretty">
      <thead>
        <tr>
          <th><%= sortable "title" %></th>
          <th><%= sortable "category" %></th>
          <th><%= sortable "rating" %></th>
        </tr>
      </thead>
      <tbody>
        <% @businesses.each do |business| %>
          <% cache(business) do %>
            <tr>
              <td>
                <% if business.created_at > 7.days.ago %>
                  <%= link_to business.title, business %> <span class="label label-primary">New</span>
                <% else %>
                  <%= link_to business.title, business %>
                <% end %>
              </td>
              <td><%= business.category %></td>
              <td>
                <%= number_with_precision(business.reviews.average("rating"), :precision => 2 || 0) 
                %>
              </td>
            </tr>
          <% end %>
        <% end %>
      </tbody>
    </table>
    <div class="pagination">
      <%= will_paginate @businesses, renderer: BootstrapPagination::Rails %>
    </div>
  </div>
<% end %>

Remove edit links from index; caching was causing links to appear even though user didn't have auth to click them
Remove edit links from index; caching was causing links to appear even though user didn't have auth to click them
