How to Get Haml to Work with Rails

Ruby on Rails with Haml - how to switch from erb

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"

Rails helper for Haml

The block passed to haml_tag doesn’t automatically get added to the output. You need to use haml_concat:

def pagination_helper(object)
haml_tag :div, :class => 'apple_pagination page_info' do
haml_concat(page_entries_info @book_formats)
haml_concat(paginate @book_formats)
end
end

Create a helper or something for haml with ruby on rails

You can use haml_tag too

def content_box
haml_tag :div, :class => "holder" do
haml_tag :div, :class => "top"
haml_tag :div, :class => "content" do
yield
haml_tag :div, :class => "bottom"
end
end

and in haml

%html
%head
%body
Maybee some content here.
= content_box do
Content that goes in the content_box like news or stuff


Related Topics



Leave a reply



Submit