Rails:如果页面不等于current_page

时间:2015-05-13 17:45:05

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

我正在尝试设置标题,以便在current_page不等于root_path时显示链接。

我目前正好相反,<% if current_page?(root_path) %> 哪个工作正常。添加NOT EQUAL TO运算符的样式是什么?

我尝试使用!= ......但无济于事。

1 个答案:

答案 0 :(得分:2)

  

添加NOT EQUAL TO运算符的样式是什么?

在Ruby中不等于!=

如果我找到了你,你就会找到这样的东西:

<% unless current_page?(root_path) %>
  <%= # do_something %>
<% end %>