0

This is my form:

<%= form_tag(method: "get") do %>
    <%= submit_tag("Submit") %>
<% end %>

When I submit this form I get a server error because there is no POST action for this URL. In my routes I have an action for GET, but it's not picked up. The error goes away when I assign an action to POST at the same URL as the GET. What am I doing wrong?

  • With your `form_tag` declaration, where should the `get` request go to? – vee Jan 10 '14 at 20:29
  • The current page, so "/" ? –  Jan 10 '14 at 20:37
  • 2
    Try the [How to submit current url](http://apidock.com/rails/ActionView/Helpers/FormTagHelper/form_tag#1185-How-to-submit-current-url). – vee Jan 10 '14 at 20:44

1 Answers1

0

Like the comment above says, you'll need to add a path to the form, so it would look something like this...

<%= form_tag whatever_the_current_page_is_path, :method => :get %>
Noah Davis
  • 1,054
  • 1
  • 15
  • 28