I have set up a ferret search using the examples in the demo app. Is it possible to have the search terms included in the URL, so that, for example, users can bookmark a search results page ? Chris -- Posted via http://www.ruby-forum.com/.
On Sun, Jul 09, 2006 at 05:51:27PM +0200, Chris Lowis wrote:> I have set up a ferret search using the examples in the demo app. Is it > possible to have the search terms included in the URL, so that, for > example, users can bookmark a search results page ?sure, setting the search form''s method to ''get'' should do the trick. Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
> sure, setting the search form''s method to ''get'' should do the trick.Thank you for taking the time to respond. I now have <%= form_tag :action => ''search'', :method => ''get''%> <fieldset> <legend>Search by street name, or zip code</legend> <input type="text" name="query" value="<%= h @query %>" /> </fieldset> <%= submit_tag ''search'' %> <%= end_form_tag %> <% if @results -%> ... <% end -%> in my view. However the URL generated after search looks like : http://localhost:3000/residence/search?method=get and doesn''t contain the search terms. Any suggestions ? Kind regards, Chris -- Posted via http://www.ruby-forum.com/.
On Mon, Jul 10, 2006 at 09:39:45PM +0200, Chris Lowis wrote:> > sure, setting the search form''s method to ''get'' should do the trick. > > Thank you for taking the time to respond. I now have > > <%= form_tag :action => ''search'', :method => ''get''%>try <%= form_tag { :action => ''search'' }, :method => ''get'' %> instead. this explicitly tells ruby where the first hash argument (url_for_options) to form_tag ends, all following arguments then will be aggrgated into the second optional argument to form_tag, options: form_tag(url_for_options = {}, options = {}, *parameters_for_url) Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Jens Kraemer wrote:> try > > <%= form_tag { :action => ''search'' }, :method => ''get'' %> > > instead. this explicitly tells ruby where the first hash argument > (url_for_options) to form_tag ends, all following arguments then > will be aggrgated into the second optional argument to form_tag, > options:Thank you Jens. In the end I had to call form_tag with () like so : <%= form_tag( { :action => ''search''}, :method => ''get'') %> but it now works, Chris -- Posted via http://www.ruby-forum.com/.