lundi 30 mars 2015

Rails4 - GET vs POST in logic that includes paths

and thank you for your time in advance. To make a long story short: I need a certain layout from some pages, and a different layout for other pages. 2 layouts in total, and these layouts only apply to the navbar and footer links in my app. Instead of making a new application_controller with a new layout, I opted for logic in the application.html.erb file, using logic. Here is what the logic looks like:



<% if current_page?(about_path) ||
current_page?(terms_path) ||
current_page?(faq_path) ||
current_page?(signup_path) ||
current_page?(signin_path) ||
current_page?(root_path) %>

<Code for one layout>

<% else %>

<Code for the second layout>

<% end %>


I understand that this isn't the ideal way to make this work, but it was the path I chose, and was curious about, so I would like to figure out how to finish with this method. The problem lies within the authentication and registration pages which should have the old layout. Everything is fine until I make a POST request (hit submit without valid info), at which point it tries to render the new layout. As I understand it, the paths in the logic above are all GET requests, so my question is this:


How can I include paths that handle POST requests? I only have two paths that fall under that category. I would love to know if this is possible, and or the syntax for it, as I will be sticking with this 'experiment' of sorts. Thanks, and have a nice day.


Aucun commentaire:

Enregistrer un commentaire