vendredi 14 avril 2017

How to sort in pagination

Current code is showing results in random order but I want to display USA list first in order to India, UK and China.

@obj = User.where(:area => ["USA","India","UK","China"]).paginate(:page => params[:page], :per_page => 1)

I am using Paginate gem.

gem 'will_paginate', '~> 3.1.0'
gem 'will_paginate-bootstrap'

Aucun commentaire:

Enregistrer un commentaire