Condition if devise action view
Hi everyone,
I am struggeling with finding out how to add a condition to hide my navbar partial if user is currently in one of the devise views. For example if user is currently in devise sessions new, I would like to hide my navbar partial. How would I accomplish this?
/ Jacob
I am struggeling with finding out how to add a condition to hide my navbar partial if user is currently in one of the devise views. For example if user is currently in devise sessions new, I would like to hide my navbar partial. How would I accomplish this?
/ Jacob
Hey Jacob (hah),
The current controller and action are in the params. So in your view, you can do something like:
The current controller and action are in the params. So in your view, you can do something like:
<% unless params[:controller] == "devise/sessions" && params[:action] == "new" %> <!-- show the menu --> <% end %>
Chris just beat me to the post - so I'll just add that Chris' answer is much better if you just want it applied to all devise controllers - much more concise if you don't need to differentiate between actions.