Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11037 (closed defect: invalid)

Opened 8 months ago

Last modified 8 months ago

form_for and render :action

Reported by: tomfmason Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc:

Description

Example code. In that code the variables set in the 'new' method are nil from within the form_for but only when that action is rendered via render :action=>'new'. Those variables are only nil from within form_for and only in the situation mentioned above. This may or may not be a defect but I was unable to find any mention of this in either the form_for or render docs.

Change History

02/07/08 16:22:13 changed by norbert

  • status changed from new to closed.
  • resolution set to invalid.

render :action doesn't run the action method again. This is not a bug.

Perhaps you should refactor the finds from the new method into a separate method so you can call that before render. Also, when a record is saved successfully a redirect is usually sent.