Friday, 14 December 2012

Ruby on Rails with HAML


Create a new app using
$ rails new demo_app_haml
then, bundle update( as usual as we do in normal app)
include "gem haml" to your gem file.
and then update your bundle.
clone this:     git clone git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml     which will configure Rails 3 to use HAML generators instead of ERB  when we run any sacffold or controller because it is annoying to constantly remove  .erb files, and or edit them into HAML syntax.
hmmm... not yet done, we need a small configuration setup that will assist in haml file generation. 
Goto Confing/application.rb add 
config.generators do |g|
     g.template_engine :haml
end
Finally run your scaffold.. that it here we have all the erb files in haml...

 

No comments:

Post a Comment