views:

233

answers:

1

The form_for helper doesn't appear to work in Rails 3. I am trying to to build a form for model and its child model.

class Person < ActiveRecord::Base
  has_one :address
end

class Address < ActiveRecord::Base
  belongs_to :person
end

In earlier versions of rails I would build the form like this:

-# Haml
- form_for @person do |f|
  ... (person fields here)
  - f.fields_for @person.address do |address_f|
    ... (address fields here)

How can I do this in Rails 3?

+2  A: 

With Rails3, you should use = form_for and = fields_for (and not - form_for and - fields_for as in Rails2).

Yannis