searchlogic icon indicating copy to clipboard operation
searchlogic copied to clipboard

order helper & pagination

Open kuntoaji opened this issue 14 years ago • 0 comments

my rails have strange behavior if I use order helper.

my controller: def index @search = User.search(params[:search]) @users = @search.paginate(:page => params[:page], :per_page => 40) end

  1. Scenario 1: multiple order helper my view: order @search, :by => :name, :as => "username" order @search, :by => :created_at, :as => "Join" will_paginate @users

If I click "username", the result is correct, ascend_by_name, but the "next" link of will_paginate helper will produce: http://localhost:3000/users?page=2&search[order]=ascend_by_created_at

  1. Scenario 2: Single Order helper my view: order @search, :by => :name, :as => "username" will_paginate @users

If I click "username", the result is correct too, ascend_by_name, but the "next" link of will_paginate helper will produce: http://localhost:3000/users?page=2&search[order]=descend_by_name

kuntoaji avatar Feb 19 '10 04:02 kuntoaji