ActionView::MissingTemplate in Posts#new
入力フォームのテンプレ呼び出しをしたいが、
テンプレがないとしてエラーが起きてしまう。
構文エラーは発生してなく、
空のインスタンスも作成しています。
erb
1 2(new.html.erb) 3 4<h2>Add New Post</h2> 5<%= render 'form'%> 6
erb
1(_form.html.erb) 2 3<%= form_for @post do |f| %> 4 5... 6
元のソース
erb
1(new.html.erb) 2<h2>Add New Post</h2> 3<%= form_for :post, url: posts_path do |f| %> 4<p> 5 <%= f.text_field :title, placeholder:'enter title' %> 6 <% end %> 7</p> 8<p> 9 <%= f.text_area :body, placeholder:'enter body text' %> 10 <% end %> 11</p> 12<p> 13 <%= f.submit %> 14</p> 15<% end %>
一応routes, controllerも記載です
ruby
1Rails.application.routes.draw do 2 3resources :posts 4 5end 6
rb
1class PostsController < ApplicationController 2... 3 def new 4 @post = Post.new 5 end 6...
ご教授お願いします
回答2件
あなたの回答
tips
プレビュー