내 form_for 몇 가지 문제가 있어요, 나는이 오류오류 : 형식의 첫 번째 인수는 무기 호를 포함하거나
First argument in form cannot contain nil or be empty
이이이 형태
<%= form_for @blog do |f| %>
<%= f.text_area :blogpost %>
<%= f.submit 'Add Blog'%>
<% end %>
입니다에게 점점 계속을 비워 둘 수 없습니다 내 컨트롤러
class BlogsController < ApplicationController
def index
@blogs = Blog.all #.paginate(page: params[:page], per_page: 5)
end
def create
@blog = Blog.create(blog_params)
redirect_to root_path, notice: "Created a Blog"
end
def update
@blog = Blog.create(blog_params)
redirect_to root_path
end
def show
@blog = Blog.find(params[:id])
end
def new
@blog = Blog.new
end
def edit
@blog = Blog.find(params[:id])
end
def destroy
@blog = Blog.find(params[:id])
@blog.destroy
redirect_to root_path
end
private
def blog_params
params.require(:blog).permit(:blogpost)
end
end
어떻게 수정합니까? 이 index.html.erb
에 속하는으로
'form'은 (는) '보기 파일'에 속합니다. – Pavan
블로그보기 폴더 – user3457760