On Wed, Jul 28, 2010 at 4:50 AM, FX < "> > wrote:This should be a hash, not an array - you have a "name" value, which
> Hi,
>
> I have a question about templates and the correct syntax.
> I have an array which contains the following data:
>
> "name1","description of name1"
> "name2","description of name2"
> ...
> "nameN","description of nameN"
>
> This array needs to be stored as an attribute of a role or node (so
> that it can be overridden)
>
> I assume it could look something like this:
>
> "host":[["name1","description of name1"],["name2","description of name2"]]
should be the key, and the descirption is a value.
This is the right syntax - you need to have <%= h[0] %> and <%= h[1]
> Now the problem (at least for me) is how do I specify this in the template?
>
> I have tried this (I assume it does not work because it needs to have
> a object and not array):
>
> <% @host.each do |h| %>
> <%= host[0] %> <%= host[1]%>
> <% end %>
%>, since that's the variable you create on iteration.
Adam
--
Archive powered by MHonArc 2.6.16.