Showing posts from August, 2011

Happy Haml :)

Haml is a much cleaner way to write ruby executable with html. Unlike erb or rhtml, you need not have to give tags for every if/for loops, no need of <> tags, only remember haml works in indentations.
 You need to give 2 spaces of indentations under the main loop.

Like for example, you are looping through each element in an array, then for the code which goes inside the loop will look like this
-['a', 'b'].each do |letter|
  = letter

gem install hamlor in bundler, add gem 'haml'make a file inside the view/ directory with extension as .haml.html
remember haml works with indentation. 2 spaces 
- has to be added for ruby code which has not to be evaluated <% %>, like for, if, else= for ruby code which has to be evaluated, similar to <%= %>% for html tags, like th, td, h1 tags are required in haml

The above two lines will create a html page, with headers as doel.

for label tag in html, in haml label will come under p tag
- form_…