Alphabar on Rails

I am working on this little project right now using Ruby on Rails and I ran into some trouble with the alphabar plugin. First, alphabar uses the with_scope method which, since Rails 2.0 I believe, has been protected, giving me some errors since I froze my Rails version. I was able to overcome this obstacle by using the send method instead. Just change the last part of the find method of the plugin from:

model.with_scope({:find => {:conditions => conditions}})
{model.find :all}


model.send(:with_scope, {:find => {:conditions => conditions}})
{model.find :all}

After I finally got that to work the plugin was very useful, although the alphabar was limited to letters and blank which is useful if you don’t need numbers. To accomodate numbers just add this to the alphabar helper:

('0'..'9').to_a.each do |i|
slots << i

Theoretically it should work for any character but I haven’t tried it yet.

So there you have it. Hoepfully somebody having trouble with this plugin will find this post useful.