tags:

views:

388

answers:

3

I'm building an app with Rails 2.3.4 and using

script/generate controller home index

to generate a controller and home page. I've got Haml installed. I get an erb file:

app/views/home/index.html.erb

but I'd prefer to have a Haml file generated instead, like:

app/views/home/index.html.haml

I recall Merb would generate .haml views instead of .erb if a haml gem was detected. Is this not available in Rails 2.3.4? I tried

script/generate controller home index --haml

but a "--haml" option is invalid.

Of course I can manually change my erb files to haml files but I'd rather have the generator do the work. Call me lazy. Suggestions?

A: 

This gem here might be useful. I don't think there is any way to do this outside of a plugin/gem. (disclaimer: I haven't tried this myself, but came across it when I was researching the same thing)

funkymunky
+1  A: 

Using Rails 3 (as well you should, it is THE FUTURE!), check out this very well written post regarding customizing generators, amongst other things.

alteveer