For rendering a partial I can use
render 'partial_name' or render partial: 'partial_name'
I came to know that render is the shorthand syntax of render partial and render will not accept additional local variables for the partial from this SO answer
I would like to know if there is any performance issue when using render instead of render partial
In Rails, the render action
"Renders the content that will be returned to the browser as the response body."
It is possible to render an action, text, the contents of a file, and other things, including a partial view.
render :action => "Create"
render :file => "/path/to/file/foo.erb", :layout => true, :status => 404
render :partial =>...
Using the partial label explicitly, disambiguates the render action for Rails ActionController.
As far as performance, I haven't done the test to confirm, but I think it's reasonable to expect it is more efficient to use render :partial for the above reasons.
When I'm looking for the nuts & bolts underlying Rails logic, this is an excellent detailed technical reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With