1、解决项目搜素 分页异常问题

This commit is contained in:
ouyangxuhua 2015-08-12 11:28:51 +08:00
parent d1418f1bbe
commit d67d21eb42
2 changed files with 12 additions and 2 deletions

View File

@ -86,8 +86,14 @@ class ProjectsController < ApplicationController
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
else else
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10) @project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
end end
@projects = @project_pages.order("created_on desc") @projects = @project_pages.order("created_on desc")
@limit = 10#per_page_option
@project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
@project_pages = Paginator.new @project_count, @limit, params['page']
respond_to do |format| respond_to do |format|
format.html { format.html {
render :layout => 'base' render :layout => 'base'

View File

@ -104,9 +104,13 @@
</div> </div>
<% end %> <% end %>
<div class="pagination">
<ul>
<%= pagination_links_full @project_pages, @user_count %>
</ul>
</div>
<%#= paginate @project_pages %>
<%= paginate @project_pages %>