From: Josh Cheek Date: 2011-02-19T19:07:15+09:00 Subject: Re: Ruby code embedded in Haml? --20cf30433f7a65da1b049c9fcbba Content-Type: text/plain; charset=ISO-8859-1 On Sat, Feb 19, 2011 at 3:30 AM, cz wrote: > Hi: > > Isit possible to embed ruby code in Haml templates. True, using > variables seems to work fine. However, even a simple for loop > generates errors. Other members have made suggestions, but none of > them have worked. Below is a simple Haml template. When it is used in > conjunction witha a Haml layout, an Html page is displayed. Four > indexes of an array are displayed. How could a for loop accomplish the > same thing? Thank you much. > > cz > > #contentID > %h3 Haml Template > %p All work and no play makes Jack a dull boy. > .divbtm > %p #{@ary.at(0)} > %p #{@ary.at(1)} > %p #{@ary.at(2)} > %p #{@ary.at(3)} > > Dashes are for zero-width ruby, such as control characters, and equal signs will embed Ruby, ie interpolation. - @ary.each do |element| %p= element --20cf30433f7a65da1b049c9fcbba--