Ruby on rails 3 Rails 3.1.rc1并接受

Ruby on rails 3 Rails 3.1.rc1并接受,ruby-on-rails-3,nested-attributes,Ruby On Rails 3,Nested Attributes,我有以下型号: class Survey < ActiveRecord::Base set_primary_key :survey_id # I'm using external DB belongs_to :user #UPDATED has_many :questions, :dependent => :destroy accept_nested_attributes_for :questions end class Question < ActiveRe

我有以下型号:

class Survey < ActiveRecord::Base
  set_primary_key :survey_id # I'm using external DB
  belongs_to :user #UPDATED
  has_many :questions, :dependent => :destroy
  accept_nested_attributes_for :questions
end

class Question < ActiveRecord::Base
  set_primary_key :question_id # I'm using external DB
  belogns_to :survey
end
Rails正在复制调查中的问题资源。也许是Rails 3.1的缺陷?该代码与《铁路工人》第197集相似。

它是在年修复的

此修复程序存在于Rails 3.1.0rc2中,因此如果您在文件中更新Rails版本:

gem 'rails', '3.1.0.rc2'

$ bundle update rails
它应该能按预期工作。

它在

此修复程序存在于Rails 3.1.0rc2中,因此如果您在文件中更新Rails版本:

gem 'rails', '3.1.0.rc2'

$ bundle update rails

它应该像预期的那样工作。

好的,问题在于
构建
函数中,因为使用
新建
它工作得很好。对不起,我对代码做了一些更改,因为原始代码完全不同。该方法实际上是“接受嵌套的属性”…,而belogns\u to显然应该属于。(如果您更正了代码,可能会对其他N00B(如我)有所帮助)好的,问题出在
build
函数中,因为使用
new
它工作得很好。对不起,我对代码做了一些更改,因为原始代码非常不同。该方法实际上是“接受”…..的嵌套属性,\u,并且belogns\u to显然应该属于\u。(如果您更正了代码,可能会对其他N00B(如我)有所帮助)谢谢,这让我困惑了一段时间。谢谢,这让我困惑了一段时间。