Calling HTML snippet from another HTML file

Hi guys. I'm relatively new to rails, not to ruby. Was wondering how can I call an HTML file(perhaps *.erb.html) from another HTML file. I'm writing HTML in the application layout(application.html.erb) and I want to abstract some parts like the footer and the upper part to another file, for easy reading and order. My clue is to call render() to each file(footer and upper), but is that fine? Do you use another way to do this? can sugget me? Thank you.

​This can be achieved by layouts. In the layouts/application.html.erb file you can call different partial views using the render keyword

<%= render 'layouts/sidebar' %>

The sidebar code can be in a file called _sidebar.html.erb in the layouts folder. The underscore is rails convention

Thanks, Ganesh​

As a newcomer to Rails I suggest you work right through a good tutorial such as That will show you the basics including how to use partials, which is what you are looking for.


Thank you Ganesh and Colin for the answers, very accurated. I really apreciate it.