【发布时间】:2015-01-16 07:44:06
【问题描述】:
有以下jbuilder模板:
json.extract! @order do |order|
json.id order.id
json.room order.room
json.note order.note
json.order_status_id order.order_status_id
json.created_at order.created_at
json.restaurant_order_items order.restaurant_order_items
json.restaurant do
json.id order.restaurant.id
json.email order.restaurant.email
json.phone order.restaurant.phone
json.place do
json.title order.restaurant.place.title
end
end
end
我不明白为什么,但响应是“{}”。所以,我需要得到类似“{ id: 10, ... }”的响应。我该怎么做?谢谢!
【问题讨论】:
-
这个答案对你有用吗?如果是,请接受,否则请更新问题并提供更多详细信息。谢谢!
标签: ruby-on-rails json jbuilder