Haml is a markup language that’s used to cleanly and simply describe the HTML of any web document without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ASP, and ERB, the templating language used in most Ruby on Rails applications. However, Haml avoids the need for explicitly coding HTML into the template, because it itself is a description of the HTML, with some code to generate dynamic content.
you can install haml in two ways
install from rubygem repository
install from source
If you prefer installing via bundle, append this line in your Gemfile.
After adding this code to your Gemfile just run “bundle install”. Haml gem give us a full freedom to convert html or erb files to haml, for that you can use
To achive this we have to install two more dependent gems. i prefer you to use that gems in development mode if you are using bundler.
Here is small code snippet which will help you to create a new haml from your erb files and delete the existing erb file in your rails application.
Lets install Rails 3 stable on ubuntu 10.4. I am going to use Ruby 1.9.2 with Ruby Version Manager and Ubuntu 10.4 32 bit version
Initially, install the necessary tools for our installation
Install Ruby 1.9.2 from Ruby version Manager (RVM). Official Rvm references available at here. Make sure that curl and git installed (from above).
After installing Rvm for the first time in your machine, you must write the following script in your profile page at very end after the load path.
After adding the above lines in to the profile, you have to make some more changes in Ubuntu.
You need to replace the above statement with if and indent code stated below till rvm loads script and add fi to the end of if statement. After the changes, your code will look like
we can make sure that the rvm is installed successfully on our machine by using the following command in the new terminal
if your rvm installed properly, you will get response as,
Now we have successfully installed our RVM. Next we have to install Ruby 1.9.2. Just enter the below code in you terminal.
IIt will take several minutes to install in your machine. After it has been installed we have to make Ruby 1.9.2 as default ruby version on to our machine.The following code will help you to achieve that
you can test your ruby version by
Lets install Rails 3, simply typing following command in your terminal
make sure rails 3 is installed
After installing rails we have to install sqllite3, to install use following lines on your terminal
Lets finally install sqllite gem by using
Now all your dependecies for installing rails3 are completed, create your “hello world” project and run it.