Dear all I am reading a rails cookbook about the auto_complete_for function, the code as below app/controllers/musicians_controller.rb: class MusiciansController < ApplicationController auto_complete_for :musician, :name def index end def add # assemble a band... end end app/views/musicians/index.rhtml: <h1>Musician Selection</h1> <% form_tag :action => :add do %> <%= text_field_with_auto_complete :musician, :name %> <%= submit_tag ''Add'' %> <% end %> My question is that, if the name attribute consists lots of duplicated values, how can I distinct them before pass to auto_complete_for? I afraid the performance would be affected if not to distinct it. Thank you very much. Valentino -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
eda.blessed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Nov-21 02:53 UTC
Re: Question about auto completion field
try this: http://wiki.rubyonrails.org/rails/pages/How+to+use+text_field_with_auto_complete On 20 nov, 23:52, Valentino Lun <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Dear all > > I am reading a rails cookbook about the auto_complete_for function, the > code as below > > app/controllers/musicians_controller.rb: > > class MusiciansController < ApplicationController > > auto_complete_for :musician, :name > > def index > end > > def add > # assemble a band... > end > end > > app/views/musicians/index.rhtml: > > <h1>Musician Selection</h1> > > <% form_tag :action => :add do %> > <%= text_field_with_auto_complete :musician, :name %> > <%= submit_tag ''Add'' %> > <% end %> > > My question is that, if the name attribute consists lots of duplicated > values, how can I distinct them before pass to auto_complete_for? I > afraid the performance would be affected if not to distinct it. > > Thank you very much. > > Valentino > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---