On upgrading my rails app from 4.0 to 4.2.5 i steeped onto a wierd issue where my form_for tag breaks and starts throwing exception.
A REST model on new action raised an UrlGenerationError exception because of the form_for tag.
For ex: if User is a model my form_for looked like this
Raised exception was
The @user object’s id is nil since it’s not yet saved in the database. Previously if it was nil that is been skipped by the the url generation. All these occurrences started throwing errors.
I have to change the form_for tag to
This posts the form to default users_path.
was changed to