This project is archived and is in readonly mode.

#5376 ✓invalid
ravinggenius

fields_for does not accept an array as first argument

Reported by ravinggenius | August 13th, 2010 @ 06:32 PM

According to documentation I found (http://railsapi.com/doc/rails-v3.0.0RC/classes/ActionView/Helpers/F...) fields_for's first argument should accept an array. However I get an error pointing at line 1 in my HAML partial (fields_for is on line 1). I verified that @node is a valid model and not an array.

= fields_for [:admin, @node] do |form|
  ...

Gives me the following error:

undefined method `model_name' for Array:Class

Replacing fields_for with form_for works:

= form_for [:admin, @node] do |form|
  ...

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages