This project is archived and is in readonly mode.

#3730 ✓resolved
James A Rosen

form_for fails for resources with no :index action

Reported by James A Rosen | January 17th, 2010 @ 11:11 PM | in 3.0.2

I declared a RESTful resource in my routes that only has :show, :new, and :create actions:

resources :foos, :only => [:show, :new, :create]

When I try to do a form_for(@foo), though, I get "undefined method 'foos_path' for #<Class>." This is because the resources call only creates a foos_path if the :index action is supplied.

I could, of course, simply define foos_path and foos_url, but I think resources should be smart enough to figure out to create those methods if :create is supplied.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages