-
Notifications
You must be signed in to change notification settings - Fork 277
Mismatched routing in scaffold #159
Description
I used the nifty:scaffold to generate a scaffold for my pre-existing Media model.
The scaffold generated the following paths (amongst others) as part of the scaffold,
- edit_media_path
- new_media_path
This caused a NameError and when I checked rake routes, I discovered that the RESTful resource routing had defined them as,
- edit_medium_path
- new_medium_path
From my explorations, it seems that Rails routing creates these paths based on the classify method but that the Nifty scaffolding uses something else.
This may be a problem in Rails itself too because the form_for method does not correctly identify the appropriate paths either when using the short form (as defined in http://guides.rubyonrails.org/form_helpers.html#relying-on-record-identification), but I would appreciate it if other more knowledgeable people could confirm that this is indeed a real issue (and that I'm not just forgetting something)
I ended up not only having to modify the paths of the scaffold but also have to add conditional code to the forms to assign the appropriate path and method.