I have this code:
<% form_for(@repair_ticket) do |f| %>
<%= text_field_with_auto_complete :rp_part, :name %>
Client
<% @clients.each do |client| %>
>
<%= client.name %>
<% end %>
How can I ;order => client.name all the results in the list ?
John S. wrote:
I have this code:
<% form_for(@repair_ticket) do |f| %>
<%= text_field_with_auto_complete :rp_part, :name %>
Client
<% @clients.each do |client| %>
>
<%= client.name %>
<% end %>
How can I ;order => client.name all the results in the list ?
in the controller:
@clients = Client.find(:all, :order => ‘name’)
in the view:
f.select :client_id, @clients.map{|c| [c.name, c.id]}