标签:
rails new my_api --api
这会做三件事:
ApplicationController继承ActionController::API而不是继承ActionController::Base。
def
show
@post
= Post.find(params[
:id
])
if
stale?(last_modified:
@post
.updated_at, public:
true
)
render json:
@post
end
end
X-Sendfile
。Rack::Sendfile
来负责发送文件。# Apache and lighttpd
config.action_dispatch.x_sendfile_header =
"X-Sendfile"
# Nginx
config.action_dispatch.x_sendfile_header =
"X-Accel-Redirect"
标签:
原文地址:http://www.cnblogs.com/limx/p/5699453.html