Implemented pagination for messages overview.

This commit is contained in:
Benjamin Meichsner 2009-03-23 11:31:36 +01:00
parent 759217763e
commit 37199bae1d
2 changed files with 3 additions and 1 deletions

View file

@ -2,7 +2,7 @@ class MessagesController < ApplicationController
# Renders the "inbox" action. # Renders the "inbox" action.
def index def index
@messages = Message.public.all :order => 'created_at DESC', :limit => 100 @messages = Message.public.paginate :page => params[:page], :per_page => 20, :order => 'created_at DESC'
end end
# Creates a new message object. # Creates a new message object.

View file

@ -2,5 +2,7 @@
%p= link_to('Neue Nachricht', :action => 'new') %p= link_to('Neue Nachricht', :action => 'new')
%div{:style => "text-align:right"}= will_paginate @messages
#messages #messages
= render :partial => 'messages', :locals => { :subject_length => 130 } = render :partial => 'messages', :locals => { :subject_length => 130 }