Suppose I have a model Person which has a one to many relationship with itself (i.e. Parent -> Child). When show.html.erb is rendered on a given @person I would like it to also include the result of rendering of show.html.erb for the parent.
Essentially I would like the correct syntax for
<%= render @person.person %>
I actually tried manually doing
<%= render :file => "/persons/1.html.erb" %>
and it didn’t work. Can someone help me understand the syntax of render? Thanks.
(Note that I actually have a more complicated model and I am rendering SVG files, not html.)
Put most of the content of show.html.erb in a file called _person.html.erb and then in show.html.erb have this:
Use person instead of @person in _person.html.erb
(Note that the file name starts with an underscore.)