Rambling Labs Blog Ramblings on software development

  • Replacing ERb with HAML on your Rails application generators

    As you may know, we've been using HAML lately for our views.

    Since I don't plan to use ERb for my views anytime soon, I want HAML to fit in as smoothly as possible.
    Luckily, there is a way to replace ERb as the default generated view.

    Just add this line to your Gemfile:

    gem 'haml-rails'

    And you should be good to go!

    Now, when you run rails generate controller test method_one method_two, you should see something like this:

          # ...
          invoke haml
          create app/views/test
          create app/views/test/method_one.html.haml
          create app/views/test/method_two.html.haml
          # ...

    Way easier than what I thought it would be. But you know, that's why I love the Ruby and Rails communities.

  • blog comments powered by Disqus