Topic: will_paginate - alphanumeric index/menu

Hi Guys,


I have will_paginate working - ordered alphabetically.

But I am ultimately trying to get the "menu" to be the alphabet - so that a user can click on a letter/number and get just the results of items whose "entry" begins with that letter/number.

Any ideas?

Thanks

Adam

Last edited by ateale (2012-07-03 08:52:19)

Re: will_paginate - alphanumeric index/menu

Well you can do is pass build your ABC as btns or links and pass the letter they press as a search param

controller

def index 
@xxx = Xxx.search(params[:search]).order(sort_column + " " + sort_direction).paginate(:per_page => 5, :page => params[:page])
end 

model

def self.search(search)
    if search
      where('row_name LIKE ?', "#{search}%")
    else
      scoped
    end
  end