title: Rails 5(ajax): wrong number of arguments (given 1, expected 0)
body: <p>I was trying to create associated model Comment for Post via ajax in Rails 5, but get the error.</p>
  
  <p>ArgumentError in Posts#show</p>
  
  <p>Showing /home/mnml/rails/ajax-app/app/views/comments/_form.html.erb where line #2 raised:</p>
  
  <p>wrong number of arguments (given 1, expected 0)</p>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>  resources :posts, only: [:new, :create, :show, :destroy] do 
      resources :comments, only: [:new, :create, :show, :destroy]
    end
  </code></pre>
  
  <p><strong>post.rb</strong></p>
  
  <pre><code>  belongs_to :user
    has_many :comments
  </code></pre>
  
  <p><strong>comment.rb</strong></p>
  
  <pre><code>  belongs_to :user, optional: true
    belongs_to :post
  </code></pre>
  
  <p><strong>posts_controller.rb</strong></p>
  
  <pre><code>  def show
      @post = Post.find(params[:id])
      @comment = @post.comments.build
      @comments = @post.comments
    end
  </code></pre>
  
  <p><strong>comments_controller.rb</strong></p>
  
  <pre><code>  def new
      @post = Post.find(params[:post_id])
      @comment = @post.comments.build
    end
  
    def create
      @post = Post.find(params[:post_id])
      @comment = @post.comments.build(comment_params)
      @comment.user_id = current_user.id
  
      respond_to do |format|
        if @comment.save
          format.html { redirect_to @comment.post, notice: 'Comment was successfully created.' }
          #format.json { render @comment, status: :created, location: @comment }
          format.js
        else
          format.html { render :new }
          format.json { render json: @comment.errors.full_messages, status: :unprocessable_entity }
        end
      end
    end
  
    private
      def comment_params
        params.require(:comment).permit(:description)
      end
  </code></pre>
  
  <p><strong>posts/show.html.erb</strong></p>
  
  <pre><code>&lt;%= render "comments/form"%&gt;
  </code></pre>
  
  <p><strong>comments/_form.html.erb</strong></p>
  
  <pre><code>&lt;form&gt;
  &lt;%= form_with [@post, @post.comments.build], id: :new_comment do |form| %&gt;
  
    &lt;div class="form-group"&gt;
      &lt;%= form.label :description %&gt;
      &lt;%= form.text_field :description, id: :comment_description, class: "form-control" %&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;%= form.submit "Comment it", class: "btn btn-default", data: { "disable-with": "Comment is saving..." } %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>comments/create.js.erb</strong></p>
  
  <pre><code>$('#comments').prepend('&lt;%= j render(@comment) %&gt;')
  </code></pre>
  
  <p>Where I do my mistake? Thanks for help</p>