我有一个功能模式链接,可以从我的 View 中的某个页面点击:
<a href="#" data-toggle="modal" data-target="#manifesto-modal">Manifesto & Rules</a>
除了可以在此页面上单击之外,我还希望它在重定向到此页面时默认显示。我还没有找到一个很好的方法来从 Controller 或其他地方对此进行编码,但无法想象它需要太多。输入表示赞赏!
最佳答案
根据文档,您可以使用 the flash (未经测试):
redirect_to your_path, flash: { manifesto_modal: true }
那么在你看来:
<% if flash[:manifesto_modal] %>
// a script to display modal on document ready
<% end %>
关于ruby-on-rails - 重定向时在 Rails 中呈现 twitter Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13264124/