form_for助手似乎不能在Rails 3中工作。我試圖爲模型及其子模型構建表單。Rails 3 form_for嵌套模型表單
class Person < ActiveRecord::Base
has_one :address
end
class Address < ActiveRecord::Base
belongs_to :person
end
在早期版本的Rails我將建立這樣的形式:
-# Haml
- form_for @person do |f|
... (person fields here)
- f.fields_for @person.address do |address_f|
... (address fields here)
我怎樣才能做到這一點的Rails 3?