I created a Rails post form, but I can't post it (form tag) / No error occurs

Any error

This mistake, I got caught twice. The first time I didn't get an error, but for some reason I can't post! There is no error statement, so you can't even search for it! I was worried.

Why is the second time (yesterday)! I thought, but it seems that the same thing happened a few months ago ... So I was able to solve it.

Also, keep a record so that the same thing does not happen.

Specifically, the following things have occurred.

① Fill out the submission form

スクリーンショット 2020-11-01 16.32.07.png

(2) Fill in the required items and press "Kiroku" to return to the initial screen for some reason. The URL is also strange.

スクリーンショット 2020-11-01 16.32.14.png

スクリーンショット 2020-11-01 16.32.22.png

What's happening

It was a simple thing. I put the form tag inside the form tag.

ruby:new.html.erb


<form>
  <%= form_for(@post) do |f| %>
~ Abbreviation ~
   <% end %>
</form>

Nesting form elements is prohibited. I want to be careful.

Reference article

form tags cannot be nested & how to deal with them [Form tag nesting and browser interpretation](https://ja.stackoverflow.com/questions/30651/form%E3%82%BF%E3%82%B0%E3%81%AE%E5%85%A5 % E3% 82% 8C% E5% AD% 90% E3% 81% A8% E3% 83% 96% E3% 83% A9% E3% 82% A6% E3% 82% B6% E3% 83% BC% E3 % 81% AE% E8% A7% A3% E9% 87% 88)

Recommended Posts

I created a Rails post form, but I can't post it (form tag) / No error occurs
I can deploy Heroku, but I get an error and can't open it
Rails <% = expression%> Why no error occurs when empty
[Rails 6.0] I implemented a tag search function (a function to narrow down by tags) [no gem]
Rails Tutorial Extension: I created a follower notification function
I can deploy to heroku, but I get an error and can't open it [Cause: MySQL]
I want to create a form to select the [Rails] category
Rails does it automatically and it helps, but I was surprised
[Rails] I can post S3 images in my local environment, but I can't switch to S3 on Heroku.