Ok, it turns out the problem was that I needed to specify
attr_accessible :members_attributes in the model, and
@group.members.build in the controller for it to work.

Found the solution here:
http://stream.btucker.org/post/93887650/accepts-nested-attributes-for-fields-for

On Jan 24, 1:11 pm, bob <[email protected]> wrote:
> Hi,
>
> I have something like this:
>
>     class Group < ActiveRecord::Base
>       has_many :members
>       accepts_nested_attributes_for :members
>     end
>
>     class Member < ActiveRecord::Base
>       belongs_to :group
>     end
>
>     -form_for @group do |form|
>       -form.fields_for :members do |member|
>         =member.text_field :display_name
>
> and nothing shows up under "form.fields_for :members do |member|".  In
> fact, if I put invalid code there, it's not even evaluated.  However,
> if I specify an invalid assocation like "form.fields_for :memberszzzz
> do |member|", the text field for :display_name does show up.
>
> Does anyone know what could be problem?
>
> Thanks!
>
> Bob

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to