我打算在这里工作就是创建一个用户 的迹象了,但绝不会在创建所述接触时,相应的接触,尽管使用build_ * 与HAS_ONE:build_ *不尽管是HAS_ONE
联系模型:
has_one :user
用户模型:
belongs_to :contact
用户控制器:
条def signup
@user = User.new
end
def signup_success
@user = User.find params[:id]
contact = @user.build_contact
contact.contactable = School.first
contact.save
end
protected
路线:
map.resources :users,
:collection => {
:signup => :get
},
:member => {
:signup_success => :any
}
什么我做错了任何想法?感谢您的任何建议。
当您尝试将其保存在控制台中时,联系人对象有什么错误? 'contact.errors.full_messages' – EmFi 2010-02-25 19:38:24