我有一个删除链接,使远程调用:
I have a delete link that makes a remote call:
<%= link_to image_tag("trash.png"), [current_user, bookcase], method: :delete, :remote => true, confirm: "You sure?", title: bookcase.image %>
在我的控制,我结束了重定向删除功能:
In my controller, I end the delete function with a redirect:
def destroy
@bookcase.destroy
redirect_to current_user
end
这工作,但它是将用户重定向到用户/ show.html.erb的文件,而不是用户/ show.js.erb文件。我怎样才能将用户重定向,指定要使用的格式?
This works, except it's redirecting the user to the 'user/show.html.erb' file instead of the 'user/show.js.erb' file. How can I redirect the user, specifying which format to use?
我是pretty的肯定,你可以在redirect_to时这样
I'm pretty sure you can specify the format in the redirect_to like this
redirect_to时CURRENT_USER,格式为:JS
上一篇:越来越可变大小的形式JavaScript和PHP(AJAX)形式、大小、JavaScript、PHP
下一篇:设置jsonSerialization maxJsonLength在ASP.net Web.Config中给出了500错误出了、错误、ASP、maxJsonLength