From a9b003b7c3e636f32b7f031d12cf1aa41dbca1b9 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 31 Aug 2009 13:22:14 +0200 Subject: paginate assets view --- app/controllers/assets_controller.rb | 13 +++++-------- app/views/assets/index.html.erb | 3 ++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 4734a54..b1abb0f 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -2,15 +2,12 @@ class AssetsController < ApplicationController layout 'admin' - # GET /assets - # GET /assets.xml def index - @assets = Asset.all - - respond_to do |format| - format.html # index.html.erb - format.xml { render :xml => @assets } - end + @assets = Asset.all.paginate( + :page => params[:page], + :per_page => 20, + :order => 'id DESC' + ) end # GET /assets/1 diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb index c9be684..fc7c029 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb @@ -3,10 +3,11 @@ <% end %> +<%= will_paginate @assets %> + - <% @assets.each do |asset| %> -- cgit v1.3
<%= image_tag asset.upload.url(:thumb) %>