Tuesday, 3 September 2013

ROR Form_for force to create action

ROR Form_for force to create action

I have a search model which is used to create searches which are stored in
the database by the create action and then redirected to @search where the
results are displayed along with the search parameters.
I want to be able to from this view (url searches/:id) post a new search
to create search :id+1 so the user can refine their search parameters.
I would like to be able to use the same form_for on both currently it
looks like this:
<%= form_for(@search, :html => { :class => "form-horizontal" }) do |f| %>
and renders as such:
<form accept-charset="UTF-8" action="/searches" class="form-horizontal"
id="new_search" method="post">
Which creates the new search but on the show view it displays this:
<form accept-charset="UTF-8" action="/search?id=9" class="form-horizontal"
id="edit_search_9" method="post">
how can I update it to force it to render the first way on all pages?
Many thanks!

No comments:

Post a Comment