Difference between render :action and render :template

前端 未结 3 1608
无人及你
无人及你 2020-12-07 16:57

What is the difference between render :action => \"new\" and render :template => \"users/new\"? I have heard that rendering template, we can

3条回答
  •  醉酒成梦
    2020-12-07 17:27

    Previously, calling render "foo/bar" in a controller action was equivalent to render file: "foo/bar". In Rails 4.2, this has been changed to mean render template: "foo/bar" instead. If you need to render a file, please change your code to use the explicit form (render file: "foo/bar") instead.

    http://guides.rubyonrails.org/4_2_release_notes.html#render-with-a-string-argument

提交回复
热议问题