我有一些嵌套的哈希。例如,我设置了一个参数。
Uncaught TypeError: Cannot read property 'isFormValid' of null
问题在于它没有许可证。
params = {
id: @account.id,
account: {
'raw_one_call_settings' => {
'service_areas' => {
'0' => {'id' => 'QWE', 'ivrid' => ''},
'1' => {'id' => 'RTY', 'ivrid' => ''}
}
}
}
}
我明白了:
params.require(:account).permit(raw_one_call_settings: {service_areas:{}})
如何获取值?
答案 0 :(得分:0)
尝试一下:
params.require(:account).permit(raw_one_call_settings: { service_areas: [:id, :ivrid] })
答案 1 :(得分:0)
试试这个
params.require(:account)
.permit(:id, :account => [:raw_one_call_settings =>{:service_areas=> [:id, :ivrid] }])