“渲染@collection"是什么意思?做? [英] What does "render @collection" do?
问题描述
我试图通过查看示例应用程序来更好地学习 Rails,同时查看 railscasts.com 来源的这一行,我注意到它是这样做的:
<%=渲染@episodes %>
这里到底发生了什么?为什么这没有记录在渲染函数中?或者是吗?
This is shorthand for
render :partial =>"情节", :collection =>@episodes
上面的表单记录在 Rails API 文档 下的 render (ActionController::Base)
.除了 Rails Guides 外,就我所见,速记形式没有记录.>
I'm trying to learn Rails better by looking at example applications, and while looking at this line of the source of railscasts.com, I noticed it does this:
<div class="episodes">
<%= render @episodes %>
</div>
What exactly is going on here? Why isn't this documented on the render function? Or is it?
This is shorthand for
render :partial => "episode", :collection => @episodes
The form above is documented in the Rails API docs under render (ActionController::Base)
. The shorthand form is not documented as far as I can see except in the Rails Guides.
这篇关于“渲染@collection"是什么意思?做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!