Is it possible to create a separate controller’s action (method) for specific partial view without involving AJAX or without doing as described here? In both these examples the views won’t be partials in Rails notion.
Is it possible to create a separate controller’s action (method) for specific partial view
Share
A partial is a fancy name for a chunk of html that isn’t a whole page.
You can render a partial in a controller action thus:
render :partial => “my_partial”
And the chunk will be rendered as contained in
_my_partial.html.erbor whatever, and with no layout.Inside an existing (ERB) template, you can use the same partial like this:
Which will render the
_my_partial.html.erband insert it at that location.Apart from that calling
renderon its own renders a view named after the action calling it, there is no special relationship between action names and view/view template names. You can readily create an action that doesn’t have a view template named after it and vice versa. However if you create an action without a view you must callrenderat some point in the action and explicitly name the view that is to be rendered, or an error will result.more details here.