Question about auto completion field


#1

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:

Musician Selection

<% 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


#2

try this:

http://wiki.rubyonrails.org/rails/pages/How+to+use+text_field_with_auto_complete

On 20 nov, 23:52, Valentino L. removed_email_address@domain.invalid