jrock2004
jrock2004

Reputation: 3501

rails form helper action not working

I am trying to use the form helper to build a form. I am trying to tell it what action to go to, but it keep redirecting to the create action

\<%= form_tag(controller: 'report', action: 'jira') do %>

Any thoughts on what could be causing this. The \ in the code above is just there so I could get code indenting.

Upvotes: 0

Views: 44

Answers (1)

Roman Kiselenko
Roman Kiselenko

Reputation: 44360

From documentation FormTagHelper#form_tag:

form_tag(url_for_options = {}, options = {}, &block)

Starts a form tag that points the action to an url configured with url_for_options just like ActionController::Base#url_for. The method for the form defaults to POST.

You should add method: :get to you form. Form always redirecting to the create action, because method POST.

try this form_tag({controller: 'report', action: 'jira'}, method: :get)

Upvotes: 1

Related Questions