Ruby on Rails Wednesday, July 4, 2018

On 4 July 2018 at 09:10, David Merrick <merrickdav@gmail.com> wrote:
> I only want the link <li><%= link_to "Users", users_path %></li> to be seen
> by admin users
>
> Header File
>
> <header class="navbar navbar-fixed-top navbar-inverse">
> <div class="container">
> <%= link_to "sample app", root_path, id: "logo" %>
> <nav>
> <ul class="nav navbar-nav navbar-right">
> <li><%= link_to "Home", root_path %></li>
> <li><%= link_to "Help", help_path %></li>
> <% if logged_in? %>

Test the role of the current user here and only show the next line if
the role is admin.

> <li><%= link_to "Users", users_path %></li>

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsLrziQNJWn5foz1Csrag12SNxt8O%3DEAcYnKkr2PGYQAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment