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.

On 13 June 2014 12:33, Damián M. González [email protected] wrote:

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.

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

Colin

On Fri, Jun 13, 2014 at 5:03 PM, Damián M. González
[email protected]
wrote:

I want
to abstract some parts like the footer and the upper part to another
file, for easy reading and order.

​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​

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