Home>

I'm looking for a way to separate the sidebar between admin and user.

  
        if admin == true
        <% = render partial:'layouts/shared/admin_leftnav'%>
        else else
        <% = render partial:'layouts/shared/leftnav'%>
        end
  

I want to do something like

Corresponding source code application.html.erb
<! DOCTYPE html>
<html>
<head>
  <% = csrf_meta_tags%>
  <meta http-equiv = "Content-Type" content = "text/html;charset = UTF-8">
  <!-Meta, title, CSS, favicons, etc.->
  <meta charset = "utf-8">
  <meta http-equiv = "X-UA-Compatible" content = "IE = edge">
  <meta name = "viewport" content = "width = device-width, initial-scale = 1">
  <% = stylesheet_link_tag'application', media:'all'%>
  <title><% = yield: title%></title>
</head>
<body>
    
      <% = render partial:'layouts/shared/leftnav'%>
    
  <main>
    <% = yield%>
  </main>
  <footer>
    <% = render partial:'layouts/shared/footer'%>
  </footer>
  <% = javascript_include_tag'application'%>
</body>
</html>
What I tried

I also thought about how to create admin_application.html.erb for admin in my controller, but I want to avoid it because it is not very smart.

class AdminController
Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.