簡體   English   中英

Rails js格式的回形針

[英]Paper clip in rails js format

在我的rails應用程序中,我有一個帶有文件附件的form_for 我正在使用paperclip上傳文件。

該模型及其附件已保存,但無法以respond_to格式響應。 錯誤消息顯示: ActionController::UnknownFormat

下面是我的代碼

<%= form_for @student, remote: true, authenticity_token: true do |f| %>

def create
  @student = Studnet.new(student_params)
  if @student.save
    respond_to do |format|
      format.js {render 'edit'}
    end
  else
    respond_to do |format|
      format.js {render 'new'}
    end
  end
end

您調用的應該是js ..而不是html / json.something like:-

Started GET "/images/user_8" for 127.0.0.1 at 2015-03-10 07:17:45 -0700
Processing by ImagesController#show as js

您可以在服務器日志中看到類似的內容嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM