Forum: Ruby on Rails difference between html.erb and .erb

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
saljamil (Guest)
on 2009-05-22 19:58
(Received via mailing list)
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.
Robert W. (Guest)
on 2009-05-22 20:13
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| ... }.
Robert W. (Guest)
on 2009-05-22 20:15
Robert W. wrote:
> The old Rails views used the extension /rhtml (for Ruby HTML). In newer

Typo correction .rhtml not /rhtml
This topic is locked and can not be replied to.