【发布时间】:2018-08-14 22:16:49
【问题描述】:
我有一个如下的 rails 动作:
def create
......
if @course.save
render json: { success: true, course: @course.info}
else
render json: { success: false, error_msg: @course.errors.full_messages }
end
请求返回状态200但没有响应数据。
nginx 日志和 rails 日志看起来正常:
# nginx log
100.116.224.40 [14/Aug/2018:18:59:12 +0800] POST "xxxxx" 200 200 27
"47.88.138.112" xxx
# rails log
method=POST path=xxxxformat=*/* controller=xxxx action=create
status=200 duration=45.94 view=0.23 params=
【问题讨论】:
-
@Gabbar 谢谢回复!我试过了还是不行!
-
您是否在 if 语句下方尝试过 byebug? @course.info 的价值是什么?
-
@course.info 是一个哈希,如果我删除它,仍然不起作用。
标签: ruby-on-rails ruby http nginx