0

在 .html.erb 中<%= link_to 'the listing', "years/1846", class: "btn btn-primary" %>有效。我怎样才能把它放在一个动作文本字段中并让它成为一个链接?

如图所示,它将被硬编码到特定记录。years是我的应用程序中的表格、模型等。不必是 Bootstrap 按钮,但确实需要看起来像一个链接,因此需要设置样式。

4

1 回答 1

0

您可以将 link_to 代码的原始 html 输出直接添加到 ActionText 字段,它应该可以工作。像 roster.description += 'the listing' 等(显然 roster 和 description 是 ActiveRecord 对象和 ActionText 字段名称的占位符名称)

于 2021-03-08T11:56:48.853 回答