为什么此方法不呈现我的.js.erb文件? [英] Why isn't this method rendering my .js.erb file?
本文介绍了为什么此方法不呈现我的.js.erb文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的视频控制器中有此方法:
I have this method in my videos controller:
def notification_go
current_user.render_read
respond_to do |format|
format.html
format.js { render 'notification_go.js.erb' }
end
end
它没有在我的videos
视图目录中呈现我的notification_go.js.erb
文件.为什么是这样?如何渲染?
It is not rendering my notification_go.js.erb
file in my videos
view directory. Why is this? How do I render it?
(我的notification_go
方法是通过AJAX请求调用的.不确定是否有什么区别.)
(My notification_go
method is called via an AJAX request. Not sure if that makes any difference.)
推荐答案
尝试通过
:format => :js
AJAX请求中的路径.
to path in your AJAX request.
这篇关于为什么此方法不呈现我的.js.erb文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文