Hi I have this concern in model/concerns/permissions_concern
This check my users table and permission_level column which is type integer.So if user has admin privileges I want him to be able to access in Navbar an specific link
module PermissionsConcern
extend ActiveSupport::Concern
def is_normal_user?
self.permission_level >= 1
end
def is_editor?
self.permission_level >= 2
end
def is_admin?
self.permission_level >= 3
end
end
I want to know if is possible to call a module to an erb page so for example:
<li class="nav-item">
<% if is_admin? %>
<%= link_to "Dashboard", articles_path, class: 'nav-link' %>
<%else%>
<li class="nav-item">
<%= link_to 'Login', new_user_session_path, class: 'btn btn-outline-success' %>
</li>
<li class="nav-item">
<%= link_to 'Register', new_user_registration_path, class: 'btn btn-outline-info' %>
</li>
<%end%>
</li>
But I get this error
undefined method `is_admin?' for #<#:0x007f962f818680> which is okay because is not a method. But is there a way to call a concern in an erb page?