如何将重定向更改为特定页面上的特定 Twitter Bootstrap 选项卡?就像是:
def destroy
@custom_article = CustomArticle.find(params[:id])
@custom_article.destroy
respond_to do |format|
format.html { redirect_to documents_url[#specific_tab_here?] }
format.json { head :no_content }
end
end
谢谢!
更新
请参阅 @PeterWong 和 @emm 的答案组合以获得解决方案。
最佳答案
这一点 JS 为我修复了它:
$(function(){
var hash = window.location.hash;
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
});
它对 turbolinks 做了一些奇怪的事情,但由于这都是基于重定向的,所以这不是问题。
关于ruby-on-rails - rails : redirect_to specific Twitter Bootstrap tab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18370052/