Rails prevent layout during AJAX request

后端 未结 1 1326
野趣味
野趣味 2021-02-19 17:36

I have searched around and have not been able to find a solution for this type of mechanic. I want to load all pages normally in Rails, but whenever I do an ajax request I just

1条回答
  •  猫巷女王i
    2021-02-19 18:14

    You don't need to add that parameter, request.xhr? will return true in your controller when it's an Ajax request. Just use that to decide whether to render the layout or not.

    0 讨论(0)
提交回复
热议问题