remove unnecessary count query for post_versions listing

This commit is contained in:
albert
2013-02-20 14:18:33 -05:00
parent 74aeb01418
commit 63394ef161
6 changed files with 90 additions and 3 deletions

View File

@@ -2,8 +2,7 @@ class PostVersionsController < ApplicationController
respond_to :html, :xml, :json
def index
@search = PostVersion.search(params[:search])
@post_versions = @search.order("updated_at desc").paginate(params[:page], :count => 1_000_000)
@post_versions = PostVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :count => 1_000_000)
respond_with(@post_versions)
end

View File

@@ -34,6 +34,7 @@ module PaginationHelper
1.upto(records.total_pages) do |page|
html << numbered_paginator_item(page, records.current_page)
end
elsif records.current_page <= window + 2
1.upto(records.current_page + window) do |page|
html << numbered_paginator_item(page, records.current_page)

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>Changes</h1>
<% if @post_versions.empty? %>
<% if @post_versions.all.empty? %>
<%= render "post_sets/blank" %>
<% else %>
<%= render "listing", :post_versions => @post_versions %>