我的一个导轨导航栏链接没有出现,但其余部分呢?

时间:2014-09-13 22:08:30

标签: ruby-on-rails ruby ruby-on-rails-4

我无法将新的博客链接显示在我的导航栏中。我正在做与以往一样的事情,我的链接始终有效。我尝试过new_blogs_path new_blog_path并指定控制器和操作。

这是我的导航链接部分:

<%= link_to "About", controller: "static", action: "about", id: @about %>
<%= link_to "Testimonials", controller: "static", action: "testimonials", id:     

@testimonials %>
<%= link_to "Store", controller: "products", action: "index" %>
<%= link_to "New Product", new_product_path %>


<% if current_user %>
  <%link_to "New Blog", new_blog_path %>
  <%= link_to "Log Out", logout_path %>
  <%= current_user.email %>.

<% else %>
  <%= link_to "Sign Up", signup_path %> 
  <%= link_to "Log In", login_path %>
 <% end %>

可以在if / else语句中找到新的博客代码。谢谢你的帮助。

在这里回答我的另一个问题:Keep getting "no file selected" when attempting to upload an image using carrier wave?

1 个答案:

答案 0 :(得分:4)

您需要使用<%= link_to "New Blog", new_blog_path %>

当您希望用户可以看到<%=时使用<%。否则,请使用不带等号的{{1}}。