syntax error, unexpected keyword_ensure, expecting

Sta*_*Dev -2 ruby ruby-on-rails

I am getting this error when trying to send a message on my rails app. Please help me get it right. The conversations.html.erb file does not have any line 36 and 38. Here is the error:

syntax error, unexpected keyword_end, expecting ')' end ^): app/views/private/conversations/_conversation.html.erb:36: syntax error, unexpected keyword_ensure, expecting ')' app/views/private/conversations/_conversation.html.erb:38: syntax error, unexpected keyword_end, expecting ')' app/views/private/conversations/_open.js.erb:10:in _app_views_private_conversations__open_js_erb___4089549709349058989_70036360651440' app/views/assignments/show/contact_user/message_form/_success.js.erb:8:in _app_views_assignments_show_contact_user_message_form__success_js_erb__1046129379162570439_70036360658520' app/controllers/private/conversations_controller.rb:18:in block (2 levels) in create' app/controllers/private/conversations_controller.rb:16:increate'

I have attached the controller and the _conversation.html.erb file.Any help offered shall be highly appreciated. Thank you

class Private::ConversationsController < ApplicationController

  def create
    recipient_id = Assignment.find(params[:assignment_id]).user.id
    @conversation = Private::Conversation.new(sender_id: current_user.id,
      recipient_id: recipient_id)

    if @conversation.save
      Private::Message.create(user_id: current_user.id,
        conversation_id: @conversation.id,
        body: params[:message_body])

      add_to_conversations unless already_added?
      respond_to do |format|
        format.js { render partial: 'assignments/show/contact_user/message_form/success'}
      end

    else
      respond_to do |format|
        format.js {render partial: 'assignments/show/contact_user/message_form/fail'}
      end
    end
  end  

  def close
    @conversation_id = params[:id].to_i
    session[:private_conversations].delete(@conversation_id)

    respond_to do |format|
      format.js
    end
  end

  private

  def add_to_conversations
    session[:private_conversations] ||= []
    session[:private_conversations] << @conversation.id
  end

  def already_added?
    session[:private_conversations].include?(@conversation.id)
  end
end
Run Code Online (Sandbox Code Playgroud)
class Private::ConversationsController < ApplicationController

  def create
    recipient_id = Assignment.find(params[:assignment_id]).user.id
    @conversation = Private::Conversation.new(sender_id: current_user.id,
      recipient_id: recipient_id)

    if @conversation.save
      Private::Message.create(user_id: current_user.id,
        conversation_id: @conversation.id,
        body: params[:message_body])

      add_to_conversations unless already_added?
      respond_to do |format|
        format.js { render partial: 'assignments/show/contact_user/message_form/success'}
      end

    else
      respond_to do |format|
        format.js {render partial: 'assignments/show/contact_user/message_form/fail'}
      end
    end
  end  

  def close
    @conversation_id = params[:id].to_i
    session[:private_conversations].delete(@conversation_id)

    respond_to do |format|
      format.js
    end
  end

  private

  def add_to_conversations
    session[:private_conversations] ||= []
    session[:private_conversations] << @conversation.id
  end

  def already_added?
    session[:private_conversations].include?(@conversation.id)
  end
end
Run Code Online (Sandbox Code Playgroud)

Ser*_*sev 6

您忘了关闭标签

 pc<%= conversation.id>
Run Code Online (Sandbox Code Playgroud)