Rails newb here. In my app I'm trying to create a database of Games that each have multiple MameControls as nested attributes. The fields for entering MameControls show up in the New view but not in Edit, the results aren't rendered in Show, and if i validate\_presence\_of :mameControls it won't save the form, stating "Mame controls can't be blank." And in the rails console, Game.first(or last, or any other record).mame\_controls returns only `[]`. So as far as I can tell the nested attribute is not being saved, even though i'm pretty sure i've set everything up similarly to what is shown in Railscast #196. Here is the Game class:

```
class Game < ActiveRecord::Base
  has_many :mame_controls, :dependent => :destroy

  attr_accessible :name, :year, :company, :designer, :genre,
  :sb_info, :wiki_link, :arcade_history_link, :arcade_museum_link, 
  :caesar_link, :wildcard_link, :mame_controls

  accepts_nested_attributes_for :mame_controls, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true

  validates_presence_of :name, :year, :company, :genre, :sb_info, :mame_controls

end

```

mame\_control.rb:

```
class MameControl < ActiveRecord::Base
  belongs_to :game

  attr_accessible :name, :game_action
end

```

The form code to enter in or edit MameControls is this.

in \_form.html.erb:

```
  <% f.fields_for :mame_controls do |builder| %>
    <%= render "control_fields", :f => builder %>
<% end %>

```

\_control\_fields.html.erb:

```
<div class="field">
 <p>
     <%= f.label :name, "Mame Control Name" %><br />
  <%= f.text_field :name %><br />
  <%= f.label :game_action, "Game Action" %><br />
  <%= f.text_field :game_action %>
 </p>
</div>

```

in games\_controller.rb:

```
 def new
    @game = Game.new
    5.times do
       mame_control = @game.mame_controls.build
     end
  end

def create
    @game = Game.new(params[:game])
end

```