title: Check the current parent controller of a nested resource
body: <p>I have a nested resource in users:</p>
  
  <pre><code>resources :users do
    resources :reservations
  end
  </code></pre>
  
  <p>In my controller actions i can get the current controller name by using controller.controller_name. So in the user show action the controller.controller_name returns "users". Likewise in the reservations show action it returns "reservations".</p>
  
  <p>But when i'm a the nested resource route like "http://mywesite/users/:id/mutations" i would like to get the parent controller of the nested resource, in this case "users". Is there any way in retrieving this using a controller property or route checker? I'm not a fan of regex my url.</p>
  
  <p>I could check my params[:user_id], but could this be error prone? I might have an registrations controller in which the :user_id could be set.</p>
  
  <p>The reason I want to have this parent resource is because i want to create a search form in my layout only when the current action has something to do with users, e.g. all actions that are performed in the users controller or nested resources controller of the users.</p>