【发布时间】:2013-08-29 07:01:36
【问题描述】:
我有一个用户模型和一个配置文件模型。在user.rb中
has_one :profile
在配置文件模型中
belongs_to :user
现在我尝试在profiles#create中为当前用户创建个人资料
@profile = current_user.profile.new(params[:profile])
它会引发未知方法“新”错误。 如何解决这个问题?请帮忙?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 associations