Check that out:
[app/controller]
class TestController < ApplicationController
def search
# i prefer doing init and postback in the same action
# but it''s up to you...
if request.post?
criteria = params[:criteria]
# put search + result stuff here
@result = "search result of using #{criteria}"
end
end
[app/views/test/search.rhtml]
<%= start_form_tag %>
<%= text_field_tag "criteria" %>
<%= submit_tag "Search" %>
<br/>
<%= @result %>
<%= end_form_tag %>
> --- Ursprüngliche Nachricht ---
> Von: Travis Briggs
<audiodude-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> An: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Betreff: [Rails] Basic search
> Datum: Wed, 26 Oct 2005 13:55:48 -0400
>
> Okay this one is probably a no-brainer, but I''m new to rails.
>
> I understand how to use forms that are linked to a model using the
> text_field helper method. However, how do you do a basic word retrieval?
> Like, I''d like to have a search box that allows you to search for
the
> model
> object with a certain title.
>
> How do I get the input to a form into a basic variable (NOT an instance of
> a
> model class)?
>
> Thanks in advance,
> -Travis
>