From 0403666cea2ed73974f8e86671d27e98d47e7c97 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 29 Apr 2014 14:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=88=86=E9=A1=B5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/softapplications_controller.rb | 9 ++++++++- app/views/softapplications/index.html.erb | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 9cc940bd..3d6a23a3 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -7,7 +7,14 @@ class SoftapplicationsController < ApplicationController # GET /softapplications.json def index @softapplications = Softapplication.all - + @limit = 5 + #new added + @softapplication_count = @softapplications.count + @softapplication_pages = Paginator.new @softapplication_count, @limit, params['page'] + @offset ||= @softapplication_pages.offset + @softapplications = @softapplications[@offset,@limit] + #new added end + #@softapplications = @softapplications[@offset,@limit] respond_to do |format| format.html # index.html.erb format.json { render json: @softapplications } diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index eed78146..710f36dc 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -59,11 +59,12 @@ <% end %> - -