Html.erb vs erb (and haml equivalents)
I'm not sure if I understand the difference between files html.erb
or haml.erb
and .erb
views for a Ruby on Rails application.
What are the benefits / advantages of each ( html.erb
/ haml.erb
or .erb
/ .haml
) file?
PS I am not asking about the difference between erb and haml files - just by adding the extension to the html file or not adding it.
a source to share
This is mostly about content-type
, and if there are any blocks in your controller respond_to
. If you declare your file with the extension .html.erb
or .haml.erb
, you reduce the amount of response that can be used by those files, which will only be served if the request is of type mime. By using only .erb
you extend the usability of your file without limiting its response type.
a source to share