title: Rails: help me avoid having to use such deeply nested routes
body: <p>I've got really long nested routes like so:</p>
  
  <pre><code># barracudas have many elephants
  resources :barracudas do
  
    # elephants have any barracudas, and have many gloworms too
    resources :elephants do
  
      # gloworms have any elephants, and have many chimpanzees too
      resources :gloworm do
  
        # chimpanzees have many gloworms
        resources :chimpanzees do
        end
      end
    end 
  end
  </code></pre>
  
  <p>As you can see there are a lot of <code>has_many, :through</code> relationships here, so it's hard to find a chimpanzees parent gloworm wihout a little help from the URL:</p>
  
  <pre><code># chimpanzees_controller.rb
  def show   
    @barracuda  = Barracuda.find(params[:barracuda_id])
    @elephant   = @barracuda.elephants.find(params[:elephant_id])
    @gloworm    = @elephant.gloworms.find(params[:gloworm_id])
    @chimpanzee = @gloworm.chimpanzees.find(params[:id])
  end
  </code></pre>
  
  <p>I would like to hide the fact that my system has barracudas, I want to change the urls from:</p>
  
  <pre><code>http://lvh.me:3000/barracudas/1/elephants/32/gloworms/5/chimpanzees/3
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>http://lvh.me:3000/elephants/32/gloworms/5/chimpanzees/3
  </code></pre>
  
  <p>Am I right in thinking that I just need to remove the nesting from the routes, and add a :barracuda_id to the session so that I can always find it in the controller? Something like this?</p>
  
  <pre><code>@barracuda = Barracuda.find(session[:barracuda_id])
  </code></pre>
  
  <p>What if I wanted to remove all mention of elephants and gloworms from the URLs too? I guess it would be the same idea right? Expiring session data will probably be the biggest job.</p>