title: Rails - How to implement :remote => true, to edit comments on the same page
body: <p>I'm building an events site using Rails 5. On the Event#show page I have a comments section which I want to give edit/update functionality to without the user leaving the page. 
  I'm trying to use <code>:remote =&gt; true</code> in the form but I'm hitting errors, here's the views and controller code -</p>
  
  <p><strong>comments/_form.html.erb</strong></p>
  
  <pre><code>&lt;%= simple_form_for([@event, @event.comments.build, :remote =&gt; true ]) do |f| %&gt;
  
  
      &lt;%= f.label :comment %&gt;&lt;br&gt;
      &lt;%= f.text_area :body %&gt;&lt;br&gt;
      &lt;br&gt;
      &lt;%= f.button :submit, label: 'Add Comment', class: "btn btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>Comments_controller.rb</strong></p>
  
  <pre><code>def update
  
      respond_to do |format|
        if @comment.update
          format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
          format.js   { }
          format.json { render :show, status: :created, location: @comment }
        else
          format.html { render :new }
          format.json { render json: @comment.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>The current error I'm getting is 'undefined method `model_name' for {:remote=>true}:Hash'. This is pointing to the events#show method in the Events controller. I'm not sure I'm using :remote => true in the correct place hence the error. This is the first time I've done this so I'm hitting errors each step of the way. Any help/assistance would be appreciated.</p>