title: Rails 5.0 - How to implement in-place editing without using best_in_place gem
body: <p>I'm building an Events site using RoR which I've just upgraded to v5.0.1 (not moving to 5.1 just yet). My events show page has a comments section at the foot of the page which, so far, only has a create and delete functionality. 
  I want to add an Edit/Update function to comments so only the user who created the comment can edit the comment if they see fit. I want them to be able to edit their comment whilst on the same page. </p>
  
  <p>I'm trying to implement these changes using remote: true &amp; Ajax, rather than rely on a gem as it doesn't appear too complex, but I've never done this before and there doesn't appear to be a clear guide via the internet/SO. Here's my views &amp; controller code - </p>
  
  <p><strong>comments_controller.rb</strong></p>
  
  <pre><code>    def create
          @event = Event.find(params[:event_id])
          @comment = @event.comments.create!(params[:comment].permit(:name, :body))
          @comment.user_id = current_user.id
  
  
          redirect_to @event
      end
  
      def update
          @comment.user = current_user
  
      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
  
  
  
      def destroy
          @event = Event.find(params[:event_id])
          @comment = @event.comments.find(params[:id])
          @comment.destroy
  
          redirect_to event_path(@event)
      end
  </code></pre>
  
  <p><strong>_comments.html.erb</strong></p>
  
  <pre><code>&lt;% if user_signed_in?  %&gt;
    &lt;p&gt;&lt;%= link_to "Edit", remote: true %&gt;&lt;/p&gt;
    &lt;p&gt;&lt;%= link_to 'Delete', [comment.event, comment],
                    method: :delete,
                    class: "button",
                    data: { confirm: 'Are you sure?' } %&gt;&lt;/p&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>My understanding is that I need to include a .js.erb file in my views/comments folder to deal with this ( edit.js.erb ?) but what I'm not clear on is exactly what javascript code I need to include in order for this to work. Also, I don't think my controller code above seems right - should this go in the Edit action? Do I also need an Event#show action in my events controller as this is where it sits in the views?</p>
  
  <p>Any assistance would be greatly appreciated.</p>