小编Gop*_*aju的帖子

我如何在rails控制器中获取Request Referer

def total
   puts requeset.referrer
   transactions = UTransaction.all
   render json: amount(transactions)
end
Run Code Online (Sandbox Code Playgroud)

我在控制台中收到以下错误

Completed 500 Internal Server Error in 38ms

NameError (undefined local variable or method `requeset' for #<Api::V1::Admin::UTransactionsController:0x007f98d49539d0>)
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails header http request referer

3
推荐指数
1
解决办法
4110
查看次数

如何在rails中增加HTTParty post方法的超时?

我在rails中有一个方法可以将发布请求发送到第三方API.代码类似于以下内容:

data = HTTParty.post("url",
  :headers=> {'Content-Type' => 'application/json'},
  :body=> { update => true, first_name => "name" }
)
Run Code Online (Sandbox Code Playgroud)

这样,在一分钟之后,该过程终止,并出现以下错误.

<Net::HTTPGatewayTimeOut 504 GATEWAY_TIMEOUT readbody=true>
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails httparty

2
推荐指数
1
解决办法
1833
查看次数

标签 统计

ruby-on-rails ×2

header ×1

http ×1

httparty ×1

referer ×1

request ×1

ruby ×1