I'm trying to have different parts of my layout included in different pages, I currently have this:
- if %w(/ /news).include? request.fullpath
= yield
- unless %w(/ /news).include? request.fullpath
which means when the URL is the homepage or the news page, the content is shown. I need this to include when there is a parameter in the homepage URL eg /?campaign=test
I've tried a few things but can't get it to recognise separate parameters.
Answer:
- if params[:controller] == 'application' && params[:action] == 'index' && params[:campaign].present?
= yield
- elsif params[:controller] == 'application' && params[:action] == 'index'
= yield
- else
Instead of request fullpath you can take params like
in your conditions.
UPD
This definetely should work.