# Nothing shows up under fields\_for when referring to a valid association

**URL:** <https://www.ruby-forum.com/t/nothing-shows-up-under-fields-for-when-referring-to-a-valid-association/182195>\
**Category:** Rails\
**Created:** [January 24, 2010, 10:14pm UTC](https://www.ruby-forum.com/t/nothing-shows-up-under-fields-for-when-referring-to-a-valid-association/182195 "2010-01-24T22:14:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bob](https://www.ruby-forum.com/u/bob)\
**Post date:** [January 24, 2010, 10:14pm UTC](https://www.ruby-forum.com/t/nothing-shows-up-under-fields-for-when-referring-to-a-valid-association/182195/1 "2010-01-24T22:14:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bob](https://www.ruby-forum.com/u/bob)\
**Post date:** [January 24, 2010, 11:50pm UTC](https://www.ruby-forum.com/t/nothing-shows-up-under-fields-for-when-referring-to-a-valid-association/182195/2 "2010-01-24T23:50:05Z")

</div>

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:

> **[accepts\_nested\_attributes\_for / fields\_for / attr\_accessible wrangling](https://stream.btucker.org/post/93887650/acceptsnestedattributesfor-fieldsfor)**
>
> I figured it was ripe time I figured out the new nested model forms in Rails 2.3.  After a bit of wrestling with the various pieces I got it working and figured I should share with a Google a few key...
