Jquery rails js格式的回形针
在我的rails应用程序中,我有一个带有文件附件的表单。我正在使用Jquery rails js格式的回形针,jquery,ruby-on-rails,Jquery,Ruby On Rails,在我的rails应用程序中,我有一个带有文件附件的表单。我正在使用回形针上传文件 模型和附件已保存,但无法以respond\u to格式响应。错误消息显示:ActionController::UnknownFormat 下面是我的代码 <%= form_for @student, remote: true, authenticity_token: true do |f| %> def create @student = Studnet.new(student_params)
回形针
上传文件
模型和附件已保存,但无法以respond\u 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
def创建
@学生=Studnet.new(学生参数)
如果@student.save
回应待办事项|格式|
format.js{render'edit'}
结束
其他的
回应待办事项|格式|
format.js{render'new'}
结束
结束
结束
您调用的应该是js..,而不是html/json。类似于:-
Started GET "/images/user_8" for 127.0.0.1 at 2015-03-10 07:17:45 -0700
Processing by ImagesController#show as js
你能在服务器日志中看到类似的内容吗?你能显示编辑代码吗?它与“新建”代码类似:你确定你能响应js并呈现视图吗?