ruby on rails - Form submission and hyperlinks using GET and POST -


I have a search resource, the user can submit searches by submitting a form and submit it, search Is saved, the show is called Action, and the results are displayed. All this happens with the default post, and all the functions are OK.

The user may want to save his search in the saved_search table (I do not use the search table for this purpose because this table stores all searches for the purpose of compiling data, and one Approval on regular basis). After the search is saved, it can be played again by clicking on the hyperlink, this is where I get problems.

There is no way to get my hyperlink to run the search function. A post request, and essential data.

Then I decided to try to get both the form submissions and the hyperlink to do a search while receiving a request, using the GET request, unable to obtain form_ to run my search, It is always rooted for my index action.

Can someone recommend a good calm solution to this problem.

Many thanks

I'm pretty sure what you try to do here If you want to submit a form with GET request, you can override the attribute of HTML to form_for assistant:

  <% form_for blarg ,: html = & Gt; {: Method = & gt; 'Get Found'}% & gt; Slow & lt;% end% & gt; Rail also supports a method of "worrying" by using a "magic" parameter (called "_method"), which makes the rail as if it has seen the HTTP method, the parameter 

If you send the form as "received", then you have to ensure that no such parameter has been set. If you want to send "POST" to the hyperlink, then it would be a way to do this (the actual post will not be sent to a click on a browser link)


Comments