[英]Why isn't this method rendering my .js.erb file?
我的視頻控制器中有以下方法:
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
文件。 為什么是這樣? 如何渲染?
(我的notification_go
方法是通過AJAX請求調用的。不確定是否有任何區別。)
默認情況下,您不需要指定渲染'notification_go.js.erb',它已被映射,具有控制器動作notication_go的notification_go.js.erb模板的文件名
def notification_go
current_user.render_read
respond_to do |format|
format.html
format.js
end
end
嘗試傳球
:format => :js
到您的AJAX請求中的路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.