require 'test_helper'
class GenerateReportControllerTest < ActionController::TestCase
setup do
@client = clients(:one)
@results = report_merge_holders(:one)
end
In `fixtures/report_merge_holders.yml`:
one:
id: 1
client_id: "1"
FOLIO_NO: "12323"
In `fixtures/clients.yml`:
one:
id: 1
isin_number: "SDS232"
code: "232DD"
name: "KJHSFDKJ"
我是#34;单元测试&#34;。我想设置&#34; client_id&#34;我得到的错误如"ActiveRecord::UnknownPrimaryKey: Unknown primary key for table report_merge_holders in model ReportMergeHolder"
。请帮帮我。
答案 0 :(得分:0)
如果正确创建了表,则不必将主ID指定为:id
。查看schema.rb文件,检查report_merge_holders
函数中的id: false
是否create_table
。移除id: false
如果它存在且事情应该有效。