我在哪里可以找到此错误消息的原因? (rails 3.2.8嵌套表格)

时间:2012-09-26 21:42:42

标签: ruby-on-rails-3 nested-attributes

我的新合同表用于工作...它仍然需要一些改进......但当前版本用于工作,但现在我收到此消息:

 3 errors prohibited this codeline from being saved:

 There were problems with the following fields:

   Contract can't be blank
   Client can't be blank
   Code can't be blank

我没有任何名为Contract,Client或Code的字段......这些是我的模型。

以下是我在codelines_controller中提出的参数:

{"contract_attributes"=>{"authnum"=>"900700", "st_date"=>"2012-09-03",
 "end_date"=>"2012-12-31"}, "client_attributes"=>{"f_name"=>"Esme", "mi"=>"J",
 "l_name"=>"Inneed", "birth_date"=>"1986-03-18", "address1"=>"62 Southy View",
 "address2"=>"", "city"=>"Fromm", "zip_code"=>"55803", "state"=>"WI",
 "medicare_num"=>"3008769788", "medicaid_num"=>"765894567", "member_num"=>"6709875-3",
 "soc_sec_care_mgr"=>"Caring Manager", "sscm_ph"=>"1-444-444-4444",
 "nurse_care_mgr"=>"Caring Nurse", "ncm_ph"=>"1-555-555-5555", "emer_contact"=>"Always
  Here", "ec_ph"=>"1-666-666-6666", "pri_care_phy"=>"The One", 
 "pcp_ph"=>"1-777-777-7777"}, "code_attributes"=>{"code_name"=>"S-5463",
 "status"=>"Active", "description"=>"Transition from schl to work"},
 "units_alloc"=>"100.00"}

正如您所看到的,所有需要数据的字段都有数据且不是“空白”

我确实签了合同,看看我是否可以帮助我设计一个按钮来为表单添加额外的属性,但我不得不取消合同,因为他们没有沟通。所以这个过程的一部分要求我让他们成为github和heroku的合作者。也许他们不得不改变一些事情来处理这个项目?

有人可以就如何解决此问题给我一些指导吗?

感谢。

1 个答案:

答案 0 :(得分:1)

查看app / models / theModelThatIsUsed.rb,如果您找到类似的内容:

validates :contract, :presence => true
validates :client, :presence => true
validates :code, :presence => true

删除那些行