Forum: Ruby on Rails Partials And the :index parameter

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.
Justin W. (Guest)
on 2006-12-29 17:32
(Received via mailing list)

I have a Client model with a has_many relationship to an Email model.
On my user form I am allowing the user to associate multiple email
addresses to a client and assign one of them as the primary address.
I have created a partial called _email that I am rendering as a
collection from an @emails array.

My issues:

1) I cannot get the :index parameter to work with the text_field in the
partial when rendering a collection of the _email partial.  Relevant

<%= text_field :email, :address, :index => :email, :size => 25 -%>

The parameters list shows up as

2) When a new client is first created, there are no email addresses
associated with it, but i would like to render my partial with index 1
and then subsequent partials added afterwards via link_to_remote will
continue that index numbering (2,3,4,etc).  This may not work because
of #1, but I thought I'd throw it out there all the same.

Help is greatly appreciated.


Justin W.
This topic is locked and can not be replied to.