Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if current devise action and view

I am using the devise gem for authentication in my rails app. I would like to be able to hide my navbar partial if user is on a specific devise action and view. For example if user is currently in devise sessions new, I would like to hide my navbar partial. How would I accomplish this?

Thanks a lot in advance!

like image 216
jacobrubyonrails Avatar asked Jan 28 '23 14:01

jacobrubyonrails


1 Answers

You can use devise_controller? helper. Docs

<%= if devise_controller? %>
  <!-- show partial -->
<% end %>

If you want to check for specific controller, use request.controller

<%= if request.controller == 'devise/registrations' %>
  <!-- show partial -->
<% end %>
like image 94
DonPaulie Avatar answered Jan 31 '23 05:01

DonPaulie