In order to have rails generators create the views with haml i'm coming across two answers and both seem to work. which is better?
Option1: declare 'haml' in the gemfile and do
config.generators do |g|
g.template_engine :haml
end
Option2: just declare 'haml-rails' in the gemfile
According to the description on the haml-rails github. It is just an integration of Haml for rails. So if you like easy go with the haml-rails gem
"Haml-rails provides Haml generators for Rails 3. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah."
Option 2 because Option 1 does not work. Declaring "haml" in your Gemfile does not give you the ability to set the default template_engine to :haml in your application.rb.
The haml-rails gem includes the generators, so that is the recommended option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With