简体   繁体   中英

ActionController::UnknownFormat / Missing template error

I am getting a "template missing error" on a .js.erb file, everything i've read says to add a respond_to which I did below but it's still not seeing my create.js.erb file, any ideas?

def create
  @conversation = Conversation.find(params[:conversation_id])
  @message = @conversation.messages.build(message_params)
  @message.user_id = current_user.id
  @message.save!

  @path = conversation_path(@conversation)

  respond_to do |format|
    format.js
  end
end

Seems like you don't have create.js.erb file in app/views/:controller_name/

If not create one at app/views/:controller_name/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM