title: «if statement» for nested routes
body: <p>I have nested routes in my <code>routes.rb</code></p>
  
  <pre><code>resources :companies do
    resources :employees
    resources :accounts
  end
  </code></pre>
  
  <p>In top menu I want to show a certain link when user is in company's controller or in nested controllers (employees, accounts). So, I want a simple  «if statement» for it.</p>
  
  <p>I've tried several approaches.</p>
  
  <pre><code>&lt;%= if params[:company_id].present? %&gt; # doesn't work in company views
    # certain link
  &lt;% end %&gt;
  
  &lt;%= if current_page?(controller: 'companies') %&gt; # doesn't work in nested controllers' views
    # certain link
  &lt;% end %&gt;
  </code></pre>
  
  <p>Of course, it is possible to use both of them with <code>or</code>, but I think it can be a better way for this.</p>
  
  <p>Thanks!</p>