Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

fields_for does not accept an array as first argument

#5376

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|
  ...

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

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. ravinggenius
    ravinggenius

    I should have better vetted this issue before filing a bug report. Removing the [] from fields_for worked perfectly.

    Please disregard.

    August 14th, 2010 @ 01:52 PM

  2. Neeraj Singh
    Neeraj Singh
    • State changed from new to invalid
    • Importance changed from to Low

    August 18th, 2010 @ 12:03 PM