title: Failing Redirection and How to Inspect Named Route Helpers
body: <p>I have a singular resource and a plural controller: PeopleController and resource :person in the routes file.  In my controller create action, I have a redirect_to @person, which is supposed to redirect to the show action for the just-created person object.   In my controller test, I assert that response.should redirect_to(@person).  It seems straightforward to me, but when I run the spec, I get this error: </p>
  
  <pre><code> Failure/Error: post :create 
   NoMethodError: 
     undefined method `people_url' for #&lt;PeopleController:0x00000002d7d988&gt;
  </code></pre>
  
  <p>It appears that the redirect in the create action is trying to go to an index action, which doesn't (and shouldn't) exist for a singular resource.</p>
  
  <p>The routing table is simple: </p>
  
  <pre><code>              person POST   /person(.:format)              people#create
            new_person GET    /person/new(.:format)          people#new
           edit_person GET    /person/edit(.:format)         people#edit
                       GET    /person(.:format)              people#show
                       PUT    /person(.:format)              people#update
                       DELETE /person(.:format)              people#destroy
  </code></pre>
  
  <p>I understand why I'm getting the undefined method error: there is no people_url for a singular resource, only a person_url.  I'm confused about why the redirect_to @person is trying to invoke people_url to begin with.  Shouldn't it default to using the person_url named route, and pass the id of the newly saved person object? I can get the test to pass by using redirect_to person_path(@person), but why is this different from what redirect_to @person is supposed to return?  </p>
  
  <p>What would be the best way to inspect the constructed URLs from the named routes in helper methods?  Besides writing failing tests of course.  That I'm really good at already :-). </p>