Controller action for partials

2019-09-04 03:41发布

I was trying to create an action for one of the partials in my rails application, but wondered how to name it. Does it have the underscore at the beginning? Like:

def _my_partial

end

or no underscore? Not mentioned in the controllers guide

1条回答
放我归山
2楼-- · 2019-09-04 04:00

A partial is a piece of view which is embedded in the main view or within another partial. The purpose of a partial is typically for re-use or to making view code cleaner.

If you need to use an action to render a partial, then it's probably better to either:

查看更多
登录 后发表回答