I believe that you are trying to allow multiple administrator accounts
to be added when creating a company.
To do so, you will need multiple fields_for as you cannot just do this
for a collection. Looking at it, it looks like it should give an error
instead of just displaying nothing. Actually I don''t know if you can
use a collection, rails surprises you very often with what it can do
and I bet someone has a solution that can do just that.
Otherwise, the solution depends on what version of rails you are
using:
Rails 2.3
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
Rails 2.2 and below
http://railsforum.com/viewtopic.php?id=719
On Apr 7, 2:44 am, Neal L
<neal.lo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi all,
>
> I''m trying to use nested object forms for the signup page of an
app to
> create the client record as well as the admin user. My problem is
> that everything in the fields_for the associated record is not getting
> rendered from the view -- not the fields, not the html, nothing.
>
> How can I make sure that when the user submits the form that the user
> is also submitted???
>
> Code:
>
> <% form_for(@client) do |client_form| %>
> <%= client_form.text_field :company_name %>
> ...
> <% client_form.fields_for :users do |user_form| %>
> <fieldset>
> <legend>Admin Account</legend>
> Username: <%= user_form.text_field :login %>
> ...
> <% end %>
> ...
> <% end %>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
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
-~----------~----~----~----~------~----~------~--~---