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
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
A
partial
is a piece of view which is embedded in the main view or within anotherpartial
. The purpose of apartial
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: