I think I don't understand routes in rails. I would like to hide navbar and footer when user is on checkout page.
So far I tried to do something like this:
<body>
<% if current_page?(new_checkout_path) %>
<%= yield %>
<% else %>
<%= render 'layouts/navbar' %>
<%= yield %>
<%= render 'layouts/footer' %>
<% end %>
</body>
and that is working. There is no navbar or footer.
My problem is when user try to submit form and validation do not want to accept that.
If I understand that correctly: Controller tries to save/create which is "post" method, but can't, so it push to do :new once again...and now I don't understand.
We are on checkouts_path but that it is actually checkouts with method: :post not :get one. That's why we don't render index page.
Why we aren't once again on new_checkout_path? Because our form wasn't saved at all? How to pass to my poor if statment something like:
<% if current_page?(new_checkout_path) || current_page?(checkouts_path, method: :post %>
Is there any way to do that this way? I had read Rails Routing from the Outside In and tried to override default routes but ended with nothing. Is there anyone patient to help me with understanding that?
Thank you.