使用JBuilder有以下代码:
json.details place.details
if (place.type == 'restaurant')
json.food_types place.details.food_types, :id
end
JSON响应:
details":{"average_check":100,"id":12},"food_types":[{"id":1}]}
现在我需要将 food_types 移至细节:
details":{"average_check":100,"id":12", food_types":[{"id":1}]}}
我该怎么做?