Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

form_for fails for resources with no :index action

#3730

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.

Reported by James A Rosen · January 17th, 2010 @ 11:11 PM

State: resolved
Milestone: 3.0.2
Assigned to: josh josh
Importance: Low

Activity

  1. José Valim
    José Valim
    • Assigned user set to josh

    Verified. This behavior is backwards incompatible with Rails 2.3.

    January 18th, 2010 @ 08:42 AM

  2. José Valim
  3. josh
  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM