在 rails 中合并 link_to 和 simple_format

Combine link_to and simple_format in rails

在 Rails 我必须使用 link_to 创建超链接。

我想在此超链接的文本中引入 \n 并使其正常工作,我必须使用函数 simple_format。我怎样才能将两者连接起来?我只在文本中尝试过,但它不起作用。如果我把它放在整个 link_to 周围,我会出错。

您可以将代码块传递给 link_to 方法,例如:

link_to(options = {}, html_options = {}) do
  # name
end

在代码块中,您可以添加 link.

文本所需的逻辑

PD:请将您当前的代码添加到问题中