views:

225

answers:

2

Which is the Recommended File Extension for rails view pages(2.3.2)

1.RHTML
2.html.erb

any significance in this.

+4  A: 

The standard naming:

template_name.mime_type.erb

Significance:

The controller will look for appropriately named template file when responding to different request formats:

def show
    @user = User.find(params[:id])

    respond_to do |format|
      format.html # Looks for show.html.erb
      format.xml # this will look for show.xml.erb
      # OR you can always use render :xml facility
      # format.xml  { render :xml => @user }
    end
end

Link for API Docs: http://api.rubyonrails.org/classes/ActionController/MimeResponds/InstanceMethods.html

Swanand
ie if it is html then name.html.erb
cdb
but why rhtml is using..
cdb
They will essentially do the same thing, the naming is for better organization. For example, your layout files are still named `application.rhtml` or `users.rhtml`
Swanand
rails will use the plain .erb file if it can't find mime_type.erb
klochner
A: 

afaik, .rhtml has long been deprecated.

giorgian