title: Rails error 'First argument in form cannot contain nil or be empty'
body: <p>I've tried all different Stack posts on how to get rid of the error '
  First argument in form cannot contain nil or be empty' and none of their solutions are working for me.</p>
  
  <p>My app involves making posts, where users can upload images. Rather than taking image url's, I want them to be able to upload straight from their file system.</p>
  
  <p>Here's my controller:</p>
  
  <pre><code>  class PostsController &lt; ApplicationController
        before_action :all_posts, only: [:feed, :create]
        respond_to :html, :js
  
      def show
        @post = Post.find_by_id(params['id'])
      end
  
  
      def create
        @post = Post.create(post_params)
      end
  
      def new
        @post = Post.new
      end
  
      private
  
      def all_posts
        @posts = Post.all
      end
  
      def post_params
        params.require(:post).permit(:caption, :content, :image)
      end
  
    end
  </code></pre>
  
  <p>And new.html.erb: </p>
  
  <pre><code>&lt;footer&gt;
    &lt;%= form_for @post, :html =&gt; {:multipart =&gt; true} do |f| %&gt;
      &lt;%= f.text_field :caption %&gt;
      &lt;%= f.text_field :content %&gt;
      &lt;%= f.file_field :image %&gt;
      &lt;%= f.submit %&gt;
    &lt;% end %&gt;
  &lt;/footer&gt;
  </code></pre>
  
  <p>People keep suggesting adding @post = Post.new to the form and the action, yet none have been working for me. </p>
  
  <p>Also, I've already checked my database, and I have 7 posts currently in there.</p>
  
  <p>Thanks so much for the help.</p>