Sha256: eaf460f648bc6a7680de7948635d070167cb246d224b36fdb7821d0ff461025a

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

<% start = Time.now %>
<table border="1">
  <thead>
    <tr>
      <th>
        id
      </th>
      <th>
        replies_count
      </th>
      <th>
        in_reply_to.id
      </th>
      <th>
        in_reply_to.favorites_count
      </th>
    </tr>
  </thead>
  <tbody>
    <% @tweets.each do |tweet| %>
      <tr>
        <td>
          <%= tweet.id %>
        </td>
        <td>
          <%= eager_load? ? tweet.replies_count : tweet.replies.count %>
        </td>
        <td>
          <%= tweet.in_reply_to.try(:id) %>
        </td>
        <td>
          <%= tweet.in_reply_to.try(:favorites_count) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<% finish = Time.now %>

<p>
  <%= eager_load? ? 'Eager loaded' : 'N+1 query' %>
</p>
<p>
  Time: <%= "%.1f" % ((finish - start) * 1000) %>ms
</p>

<p>
  <%= link_to 'Swtich', url_for(eager_load: !eager_load?) %>
<p>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-precount-0.4.1 sample/app/views/application/index.html.erb
activerecord-precount-0.4.0 sample/app/views/application/index.html.erb