开发者

rails render question

My question is about rails rendering rule. if the the following line of code

render "intentions"

appears in a rails app, how do you interpret it? my understanding is that rails will try to find an action named intentions, and find the action's template file named intentions.html.erb under the current controller's view directory, and finally render it.

but in my caee, in a 100% working app, there is no action named intentions under the current controller. but there is a template file named _intentations.html.erb under current controller's view directory and it is this temp开发者_JS百科late finally be rendered.

what kind of rendering rule it is? I need a explanation. thanks in advance.


Rails automatically looks through your views when rendering to see if any match. If you are calling render from within a view it looks for a partial view, which is defined by a underscore as the first character in its name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜