视图(HAML):
- kind.apanages.each do |apanage|
= number_field_tag "fact[apanage[#{apanage.id}]]", ''
控制器:
1。不要使用许可证:
render :json => params
{ “UTF8”: “✓”, “实”:{ “ENTITY_ID”: “27”, “属地”:{ “1”: “7”, “2”: “13”, “3”: “2”, “4”: “1”, “6”: “20”, “7”: “23”, “8”: “10”,}}, “提交”: “结束”, “动作” : “事实”, “控制器”: “实体”}
2。使用许可证(var 1):
render :json => params.require(:fact).permit(:entity_id, :apanage => [])
{ “ENTITY_ID”: “27”}
3。使用许可证(第2版):
render :json => params.require(:fact).permit(:entity_id, apanage: [:id, :content])
{ “ENTITY_ID”: “27”, “属地”:{}}
我如何允许阵列'apanage'?
答案 0 :(得分:1)