what is the difference between link_to, redirect_to, and render?

后端 未结 9 821
余生分开走
余生分开走 2020-12-09 08:16

I am confused about the main difference(s) among link_to, redirect_to and render in Rails. anyone can please explain.

9条回答
  •  忘掉有多难
    2020-12-09 08:29

    From the official Rails guides:

    As you've seen, render tells Rails which view (or other asset) to use in constructing a response. The redirect_to method does something completely different: it tells the browser to send a new request for a different URL.

提交回复
热议问题