Ruby on Rails Tuesday, December 28, 2010

Marnen Laibow-Koser wrote in post #971140:
> Finne Jager wrote in post #971133:
>>> Since your resources are nested, you need to use the array syntax of
>>> form_for so that the proper route is generated.
>>
>> <%= form_for :command_officer, @command_officer do |f| %>
>
> No! You need the *parent* resource names in there, I think. Rails
> already knows what kind of resource @command_officer itself is.

Hmm, it seems to work like that without the parent resource.
Probably because I have CommandOfficers#create like this?

def create
@timesheet = Incident.find(params[:incident_id]).timesheet

respond_to do |format|
if @timesheet.create_command_officer(params[:command_officer])
..

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment