twitter bootstrap模态数据属性参数中的html文本

这来自Twitter Bootstrap模态rails删除按钮不起作用

如何传递html代码以在Twitter Bootstrap模式中显示? 链接在这里

 raw(post.text), class: 'label' %> 

post.text是HTML代码。 现在它显示格式错误的链接。

谢谢

我认为这里的问题可能就是你对“原始”的使用。 如果你在link_to帮助器中使用原始html,它可能会搞乱链接的引用。 例如,你可能得到这样的东西:

 world" https://stackoverflow.com/questions/12449582/html-text-in-twitter-bootstrap-modal-data-attributes-parameter/...> 

那会弄乱你的链接标签。 我不确定你的其他观点是如何组合起来的,但我认为你应该能够放弃’原始’方法:

 <%= link_to t('delete'), post, method: :delete, confirm: t('delete_this_question'), 'data-my-message' => post.text, class: 'label' %>