Forum: Ruby on Rails syntax for the two flavors of field helpers

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bdf31c9ed36b1e66e2c7d819500aa47f?d=identicon&s=25 Brian (Guest)
on 2007-06-15 20:17
(Received via mailing list)
I'm using the following in a form_for, in order to display and edit
two activity_details in the same form as an activity.

      <% fields_for "activity_detail[]", @delivery do |detail| %>
              <%= detail.text_field 'start_mileage' %>
      <% end %>
      <% fields_for "activity_detail[]", @pickup do |detail| %>
              <%= detail.text_field 'end_mileage' %>
      <% end %>

It works like a charm.  However, I'd now like to use Stuart Rackham's
date kit helper to format and select some dates for each activity

e.g. <%= date_field('person', 'birthday', :value => @person.birthday)

My question is this: What arguments do I pass for this style (non-
member) of form helper in the context of an array of models in a
fields_for, as above?

Page 490 of AWDWR 2nd ed. gives a clue that it should be possible.
Their (very simple case) example goes like this:

<% form_for :user do |form| %>
    Name: <%= text_field :user, :name %>

Any thoughts?

This topic is locked and can not be replied to.