How do i get request.uri in model in Rails?

后端 未结 6 375
一生所求
一生所求 2021-02-01 07:00
$request = request

When I write this in controller, it will work. But if i need this variable in Model or Application controller, How can i ?

6条回答
  •  清酒与你
    2021-02-01 07:29

    you will need to do a hack to get request.uri in the model. which is not recommended. You should pass it as a params in the method which is defined in the model.

提交回复
热议问题