Re: Paginate with Rails 2.0.2 question

Ar Chron
Wed, 09 Apr 2008 04:54:14 -0000

Another vote for will_paginate...

get_order and get_filter are application helpers in my app, and I keep a
short list of user preferences (like their current filter, and current
sort preferences) in the session...


  def index
    order = get_order(''projectview'',
''proj_name'')
    cond = get_filter(''project'', ''scenario'')

    # retrieve the data
    @projectviews = Projectview.paginate :page => params[:page],
:per_page => session[:userpref].page_len, :order => order, :conditions
=> cond

    respond_to do |format|
      format.html
      format.xml  { render :xml => @projectviews }
    end
  end
--
Posted via http://www.ruby-forum.com/.