A short question from newbie - hope wouldn’t be a problem for you.
I am playing with autocomplete features in rails -
In View:
<%= text_field_with_auto_complete :model, :attribute %>
In Controller:
auto_complete_for :model, :attribute
(found many examples in www)
So far, so gut. Autocomplete works. But I want the following - if I type
‘m’, only words starting with ‘m’ to appear.
I have the word - ‘Belgium’ - when I fill ‘m’ in the field, ‘Belgium’ is
fetched out, cause there is a ‘m’ in it.
Could someone explain me what is missing and probably give me some
directions?
So far, so gut. Autocomplete works. But I want the following - if I type
‘m’, only words starting with ‘m’ to appear.
I have the word - ‘Belgium’ - when I fill ‘m’ in the field, ‘Belgium’ is
fetched out, cause there is a ‘m’ in it.
auto_complete_for :model, :attribute
(found many examples in www)
So far, so gut. Autocomplete works. But I want the following - if I type
‘m’, only words starting with ‘m’ to appear.
I have the word - ‘Belgium’ - when I fill ‘m’ in the field, ‘Belgium’ is
fetched out, cause there is a ‘m’ in it.
If this doesn’t work, you might just have to define your own
auto_complete_country method (see page 547 in Agile), which is really
what auto_complete_for is doing for you anyway.