Reputation: 181
I have a couple links that I want to hide unless the user is authorized to see it. I created an extra column in my User model that is called super and I want to do something similar to the code below:
<% if current_user.super == true %>
<li><%= link_to "Hidden", hidden_path %></li>
<% end %>
The super is defined as a boolean and already set to true. I'm getting an error saying that they don't recognize "super"
Upvotes: 0
Views: 1010
Reputation: 454
super
is a ruby keyword,. With devise you can check as
<% if current_user.present? %>
<li><%= link_to "Hidden", hidden_path %></li>
<% end %>
or
<% if user_signed_in? %>
<li><%= link_to "Hidden", hidden_path %></li>
<% end %>
Devise provides these helper methods,
https://github.com/plataformatec/devise#controller-filters-and-helpers
Upvotes: 1