Nothing shows up under fields_for when referring to a valid association

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

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: