Question

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?

Was it helpful?

Solution

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 %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top