Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails with Haml - how to switch from erb

I am in the process of switching to HAML from erb files. I added the haml gem to my system. I created the app/views/layouts/application.html.haml file. Should I just delete the application.html.erb file?

Also, there is still the /public/index.html file which gets rendered as the default page. I want to make my own default index.html.haml page. Where do I place it and how do I make the system render that file instead of the default index file?

Thanks!

like image 850
GeekedOut Avatar asked Jun 01 '12 15:06

GeekedOut


2 Answers

Yes you can just delete the ERB version of any views you have converted over to HAML.

As for your other question, delete the public/index/html file. Next, you may want to add a PagesController and have an action in there like index, and a corresponding view, and put your "home page" stuff in there.

Then in your routes file, add:

root :to => "pages#index"
like image 199
MrDanA Avatar answered Nov 01 '22 16:11

MrDanA


u can autoconvert and delete all erb files using this script

for i in `find app/views -name '*.erb'` ; do html2haml -e $i ${i%erb}haml ; rm $i ; done

And simply delete index.html in public folder

like image 34
Yuri Barbashov Avatar answered Nov 01 '22 18:11

Yuri Barbashov