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
How to Reference a Function in Ruby
Couldn't Require Openssl in Ruby
Thread Safety: Class Variables in Ruby
How to Install Ruby 1.9.3 in MAC Os X Lion
Where to Put Ruby Helper Methods for Rails Controllers
Adding a Directory to the Load Path in Rails
How to Deal with the Conflict Between Activesupport::JSON and the JSON Gem
What's the Difference Between Gets.Chomp() VS. Stdin.Gets.Chomp()
How to Decompress Gzip String in Ruby
How to Remove Gem from Ruby on Rails Application
How to Install Rvm System Requirements Without Giving Sudo Access for Rvm User