Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between .erb , .rhtml and .html.erb?

What is the difference between .erb, .rhtml and .html.erb?

like image 731
sameera207 Avatar asked May 29 '10 19:05

sameera207


People also ask

What is a HTML ERB file?

ERB (Embedded RuBy) is a feature of Ruby that enables you to conveniently generate any kind of text, in any quantity, from templates. The templates themselves combine plain text with Ruby code for variable substitution and flow control, which makes them easy to write and maintain.

How do I view HTML ERB?

View templates HTML tags provide static web pages only but ERB tags give us dynamic information in that HTML template. To view the template file, go to Rails application >> app >> View>> Home folder where the templates files are available.


1 Answers

Nothing, really. It’s just a change of philosophy between Rails 1 and Rails 2. Before Rails 2, you had file.rhtml, file.rxml and file.rjs. In Rails, that changed to file.content_type.template_engine. So with file.html.erb, the content type is html and the template engine is ERb. rxml is now xml.builder and rjs should now (mostly) be js.rjs

In the new rails 3.0 .rhtml files will be unsupported. .html.erb is the new standard.

like image 99
Mohit Jain Avatar answered Oct 13 '22 07:10

Mohit Jain