Hello,
I know what I am trying to do is pretty basic but for a newbie like me
everything is very daunting right now. Please help me.
The scenario I am trying to program is this. The user enters a string in
the
search textfield. I will use his entered value to query the database for
a
matched record and then display the attributes of the fetched record.
That
is it.
Here is my controller that hopefully on submission from the UI will
retrieve
the data
===in controller route_controller.rb====
def display_route
s = params[‘route’][‘name’]
@searched_route = Route.find_by_name(s)
end
=====list.rhtml=================
<%= text_field_with_auto_complete :route, :name %>
=====end list.rhtml==============
I don’t have a view yet to display the queried result. The confusion is
because I am not sure how I should use the form_tag or form_for and also
how
to wrap it around the textfield that has autocomplete enabled above.
Another
dilemma I have is the fact that I would ideally like to hit enter in the
textfield to submit the form. But I am not sure if I want to use POST
since
I am getting stuff I should probably use a GET.
I am really confused and the ruby syntax is irritating when you are
learning
it. Please help me.
Thanks
Vijay