I was thinking about doing an alphabetical navigation for i.e list of users (there would be alphabet at the top of the list and by clicking on a character the list would get filtered).
I did some googling but didn't find any plugin or quick hack sorting this problem out. It's however such a common thing that I was wondering whether there isn't really some.
Any suggestions or ideas are very welcome
I was just finishing up something on just that topic. Let me know if this helps you and give me some feedback if you can!
maybe something like
<% ('A'...'Z').each do |letter| -%>
<%= link_to letter, :controller => :user, :action => :list,
:starts_with => letter -%>
<% end -%>
<% @users.each do |user| -%>
<% end -%>
class User < ActiveRecord::Base
# note: use of mysql db functions may not be portable
find(:all, :conditions => ["UCASE(LEFT(last_name,1)) = ?", initial.upcase]
class UserController < ApplicationController
@users = User.find_by_last_initial(params[:starts_with])
@users = user.find(:all)
Thank you very much Chris,
that’s exactly what I was dreaming about
Chris Hall wrote:
I’m sorry I overlooked your post and implemented it by Chris’s
suggestion. I will try, however, to look at your writing and give you
Brian Hogan wrote: