[Solved] First argument in form cannot contain nil or be emptyy


in db/create_post.rb

t.string :title
t.text :body

then do rake db:migrate (it migrate schema of data base)

 class PostController < ApplicationController


   before_action :find_post, only: [:show, :edit, :update, :destroy]

    def new
       @post = Post.new
    end

    def create
       @post = Post.new(post_params)
       if @post.save
        redirect_to posts_path
       else
        render 'new'
       end
     end

     def show

     end

    def post_params
       params.require(:post).permit(:title, :body)
    end

    def find_post
    @post = Post.find(params[:id])
    end

    end

in post/new.html.erb

<%=form_for @post do |f|%>
<%= f.label :title %><br>
<%= f.text_field :title %><br>
<%= f.label :body %><br>
<%= f.text_area :body %><br>
<%end%>

in post/index.html.erb

<%@post.each do |post|%>
<%=post.title%>
<%=post.body%>
<%end%>

solved First argument in form cannot contain nil or be emptyy