我heve案例模型。案例模型有3個實驗室模型id。
案例模型實驗室預計,得到字符串
belongs_to :lab1, foreign_key: 'lab1', class_name: 'Lab', inverse_of: :lab1, conditions: {step1: true}
belongs_to :lab2, foreign_key: 'lab2', class_name: 'Lab', inverse_of: :lab2, conditions: {step2: true}
belongs_to :lab3, foreign_key: 'lab3', class_name: 'Lab', inverse_of: :lab3, conditions: {step3: true}
在Lab模式
has_many :lab1, foreign_key: 'lab1', class_name: 'Case', inverse_of: :lab1
has_many :lab2, foreign_key: 'lab2', class_name: 'Case', inverse_of: :lab2
has_many :lab3, foreign_key: 'lab3', class_name: 'Case', inverse_of: :lab3
而且也形成的情況下,教職員
.lab_group
= f.association :lab1, label: false, input_html: {'data-placeholder'=> t('step.one')}
= f.input :lab1_delivered, label: t('case.done')
.lab_group
= f.association :lab2, label: false, input_html: {'data-placeholder'=> t('step.two')}
= f.input :lab2_delivered, label: t('case.done')
.lab_group
= f.association :lab3, label: false, input_html: {'data-placeholder'=> t('step.three')}
= f.input :lab3_delivered, label: t('case.done')
但是,當我試圖挽救它,我有一個錯誤
Lab(#70207759169540) expected, got String(#70207716712320)
和請求參數
{"utf8"=>"✓",
"authenticity_token"=>"G0BWY6V6tkxRt81I0ZOxKXs8RD/7cdfbZfhVfRTmboo=",
"case"=>{"number"=>"123",
"doctor_id"=>"1",
"lab1"=>"1",
"lab1_delivered"=>"0",
"lab2"=>"2",
"lab2_delivered"=>"0",
"lab3"=>"2",
"lab3_delivered"=>"0",
"delivered"=>"0",
"patient"=>"",
"comment"=>"for example"},
"commit"=>"Save"}
和屏幕
我怎樣才能解決呢?
你應該表現出該錯誤所指代碼:**您的「創建」操作** – deefour 2012-08-15 22:02:58