Paginate with sort by


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def list
  2. @page_title ='List books'
  3. # Good job!
  4. sort_by = params[:sort_by]
  5. @book_pages, @books = paginate :books, :order => sort_by, :per_page => 10
  6. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.