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

How can i get Request Referer in rails controller

def total
   puts requeset.referrer
   transactions = UTransaction.all
   render json: amount(transactions)
end

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

Completed 500 Internal Server Error in 38ms

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

您有正确的方法,referrer,但您需要在 request 对象上调用它。

puts requeset.referrer

应该是

puts request.referrer