As look for a better way and cleaner code,

I am looking for Rails Render pages on the application.html.erb, as I know how the 'render unless' work like

     <%= render 'shared/jumbotron' unless  
                        current_page?(page2_path) ||
                        current_page?(page3_path) ||
                        current_page?(page4_path) ||
                        current_page?(page5_path) || 
                        current_page?(page6_path) || 
                        current_page?(page7_path) || 
                        current_page?(page8_path) || 
                        current_page?(page9_path)%>

as I don't want like this code as I feel it bit obstructed or mess, as I think it ok for one page but not more than 10 pages as

I want this list of pages to replace page1_path that it will show only page1_path and not rest of all paths like this below

 <%= render 'shared/jumbotron' "something like that Show only" 
                            current_page?(page1_path)%>

so I don't have to add every time if I create a new path in the application.html.erb.

1 Answers

1
Fire Lancer On Best Solutions

You can use if as well as unless after a statement. So if you wanted to render jumbotron only on a single page, you might do this:

 <%= render 'shared/jumbotron' if current_page?(page1_path)%>