# Difference between html.erb and .erb

**URL:** <https://www.ruby-forum.com/t/difference-between-html-erb-and-erb/168584>\
**Category:** Rails\
**Created:** [May 22, 2009, 5:58pm UTC](https://www.ruby-forum.com/t/difference-between-html-erb-and-erb/168584 "2009-05-22T17:58:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saljamil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@saljamil](https://www.ruby-forum.com/u/saljamil)\
**Post date:** [May 22, 2009, 5:58pm UTC](https://www.ruby-forum.com/t/difference-between-html-erb-and-erb/168584/1 "2009-05-22T17:58:44Z")

</div>

I spend few hours debugging a flash chart issue. At the end and after  
a lot of trial and error, I switched my view name from dashboard.erb  
to dashboard.html.erb and that resolved the problem. Any idea why? I  
tried to google for the difference between the two but could not find  
anything meaningful. I have a mix of views with only .erb and html.erb  
in my app. Thanks for the insight.

---

<div class="post-metadata">

**Author:** ![saljamil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@saljamil](https://www.ruby-forum.com/u/saljamil)\
**Post date:** [May 22, 2009, 6:13pm UTC](https://www.ruby-forum.com/t/difference-between-html-erb-and-erb/168584/2 "2009-05-22T18:13:47Z")

</div>

saljamil wrote:

> I spend few hours debugging a flash chart issue. At the end and after  
> a lot of trial and error, I switched my view name from dashboard.erb  
> to dashboard.html.erb and that resolved the problem. Any idea why? I  
> tried to google for the difference between the two but could not find  
> anything meaningful. I have a mix of views with only .erb and html.erb  
> in my app. Thanks for the insight.

The old Rails views used the extension /rhtml (for Ruby HTML). In newer  
Rails versions the rendering engine and format have been separated in  
order to support multiple presentations using the same controller  
actions.

You are saying with dashboard.html.erb is that your view format is HTML  
using the ERB (Embedded Ruby) rendering engine.

But, you can also have other formats and other rendering engines using  
the same controller.

They might look something like this:  
dashboard.iphone.erb # HTML styles for iPhone using ERB engine  
dashboard.js.rjs # JavaScript using RJS  
dashboard.xml.builder # XML format using the XML builder

All these other views share the same controller action by using  
respond\_to :format { |format| … }.

---

<div class="post-metadata">

**Author:** ![saljamil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@saljamil](https://www.ruby-forum.com/u/saljamil)\
**Post date:** [May 22, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/difference-between-html-erb-and-erb/168584/3 "2009-05-22T18:15:02Z")

</div>

Robert W. wrote:

> The old Rails views used the extension /rhtml (for Ruby HTML). In newer

Typo correction .rhtml not /rhtml
