I'm trying to set a header to show links if the current_page is not equal to root_path
.
I currently have the opposite, <% if current_page?(root_path) %>
which works fine. What is the style for adding the NOT EQUAL TO operator?
I have tried using !=
... but to no avail.
What is the style for adding the NOT EQUAL TO operator?
not equal in Ruby is !=
.
If I get you right, you're looking for something like this:
<% unless current_page?(root_path) %>
<%= # do_something %>
<% end %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.