我使用的是 Bootstrap 3,我可以做大多数链接,但是当“link_to”函数包含在其他东西中时会出现问题。
这些工作
<li><%= link_to "Contact", contact_path %></li>
<li><%= link_to "Sign Up", register_path %></li>
我不知道如何为这些使用“link_to”
<a class="navbar-brand" href="#">Project</a>
元素路径为root_path
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Resources<b class="caret"></b></a>
资源的路径是resources_path
最佳答案
你可以这样做:
<%= link_to "Project", root_path , class: 'navbar-brand' %>
<%= link_to resources_path, class: 'dropdown-toggle', data: {toggle:'dropdown'} do %>
Resources <b class="caret"></b>
<% end %>
关于html - 在其他 HTML 标签中使用 "link_to",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18389731/