For some of you that don’t know this yet (don’t be ashamed of yourself, I only heard about it a a few months back), Rails 2 recommends a new file extension for your template file. At this point, everyone was using template extensions like:
To unify the template files, the Rails developers have come with a clever solution: changing the template extensions so that they math up and tell you in what format they are. By doing this, your new template extensions should look like this:
You are probably thinking: “everything looks alike now, except the rjs and haml templates. Why not using .js.erb? Well, the answer is quite simple.
- .html.erb -> response format is in HTML, parsed with ERB
- .html.haml -> response format in HTML, parsed with HAML
- .xml.erb -> response format in XML, parsed with ERB