技術と魚

雑感と備忘録

If your new Rails app renders a duplicate html after action, you should see..

whether you're using .erb extensions without .html .

Turbo automatically adds text/vnd.turbo-stream.html into Accept header after redirect. If you use .erb not .html.erb for view files, they are going to be treated as .turbo-stream.erb first. In turbo-stream, layout file won't be rendered. The entire response body may not have <html> and <body> tag and they are going to be appended. Therefore, the html was duplicated.

Replace view extensions from xxx.erb to xxx.html.erb.