0
McEntity.joins(:member_credit_scores).includes(member_credit_ent_profile: :entity).where('sf.accountx.namex like ?', "% Time%").first
以上是我的查詢。我期待的是寫入包含在rails4中的嵌套查詢
mc_entity = {
entity_sf_account_id: '0014PRD000fkeejAAA',
license_date: Date.today, portfolio_type_id: @portfolio_type.id,
technology_description: "some technology_description", is_rejected: false, credit_value_rating_type_id: @credit_rating_type.id,
member_credit_scores: {
"0" => {
avoided_expense: 151515, likelihood_of_assertion: 15, avoided_expense_notes: "some expense notes",
likelihood_notes: "some likelihood notes", is_approved: true
},
"1" => {
avoided_expense: 303030, likelihood_of_assertion: 30, avoided_expense_notes: "some random expense notes",
likelihood_notes: "some random likelihood notes", is_approved: false
}
}
}
但是我得到的是McEntity與沒有任何關係的數據。
mc_entity = {
entity_sf_account_id: '0014PRD000fkeejAAA',
license_date: Date.today, portfolio_type_id: @portfolio_type.id,
technology_description: "some technology_description", is_rejected: false, credit_value_rating_type_id: @credit_rating_type.id,
}
您是否對您的結果對象試過'to_json'? – RAJ
是的,它沒有關係數據,但急切的加載正在工作,因爲當我檢索子記錄時它不會再次寫查詢 – santosh
你可以添加它的問題,它看起來像嗎? – RAJ