Including sub templates

Hello,

I apologize in advance because I think this has been asked before… But I can’t seem to find it in the archives.

How do you include another .erb in a template?

In my .erb, can I try something like this? (erubis -z syntax check comes out ok)
<% ERuby.import(“schema.yaml.erb”) %>

Or is it better to do something like in Ruby On Rails:
<% render :partial => “schema” %>
Where it’d reference a file called “_schema.yaml.html.erb”?

Which would work, and also, which is better?

-Paul

This is a limitation of ERB not chef per-se. For instance, in the
puppet world I had to do this:

You may just have to resort to actually including all the
possibilities inside of the ERB as conditional blocks. I've personally
not had need to try the above with Chef yet.

On Tue, Apr 5, 2011 at 1:01 PM, Paul Choi paulchoi@plaxo.com wrote:

Hello,
I apologize in advance because I think this has been asked before... But I
can't seem to find it in the archives.
How do you include another .erb in a template?
In my .erb, can I try something like this? (erubis -z syntax check comes out
ok)
<% ERuby.import("schema.yaml.erb") %>
Or is it better to do something like in Ruby On Rails:
<% render :partial => "schema" %>
Where it'd reference a file called "_schema.yaml.html.erb"?
Which would work, and also, which is better?
-Paul