I have a situation where the header partial is called by the standard layout. (This is fairly common I assume) In the header is a search box - just like on stackoverlow. However, when the user is on the search page, I want to remove the search box from the header.
What I attempted to do was put a method in the ApplicationHelper.rb file like this:
def search_page?
return false;
end
And then in SearchHelper.rb I have this:
def search_page?
return true;
end
This doesn't work because the search_page function in SearchHelper.rb is the one that is being used no matter what controller is rendering the view. I know I could define a new layout and add a parameter to the header partial to signal not to render the search box, but that seems like overkill.