使用 link_to 从表单字段进行外部 link 调用
using link_to for an external link calling from form fields
我以前能够使用以下代码 link 到表单中列出的外部站点。但是,我无法在这里工作。我的控制器定义了参数,它在视图和我的 db/schema (t.string "website") 中。
有什么我遗漏的吗?
/显示
<p>
<strong>Website:</strong>
<%= link_to @woman.website %>
</p>
该网站显示在我的数据库的活动管理员中,但不是 link。这是表单部分要求用户输入的内容:
/_表格
<div class="form-group">
<%= f.label :website %><br>
<%= f.text_field :website, class: "form-control" %>
</div>
每次我单击 link,它只会重新加载我所在的同一页面。将不胜感激任何见解。
您错过了 href
部分,试试这个
<%= link_to @woman.website, @woman.website %>
我以前能够使用以下代码 link 到表单中列出的外部站点。但是,我无法在这里工作。我的控制器定义了参数,它在视图和我的 db/schema (t.string "website") 中。
有什么我遗漏的吗?
/显示
<p>
<strong>Website:</strong>
<%= link_to @woman.website %>
</p>
该网站显示在我的数据库的活动管理员中,但不是 link。这是表单部分要求用户输入的内容:
/_表格
<div class="form-group">
<%= f.label :website %><br>
<%= f.text_field :website, class: "form-control" %>
</div>
每次我单击 link,它只会重新加载我所在的同一页面。将不胜感激任何见解。
您错过了 href
部分,试试这个
<%= link_to @woman.website, @woman.website %>