Recommended file extension for rail viewing pages (2.3.2)

What is the recommended file extension for rail viewing pages (2.3.2)

1.RHTML
2.html.erb

any meaning in that.

+1
source share
2 answers

Standard naming:

template_name.mime_type.erb

Value:

The controller will search for the corresponding template file when responding to various 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 documents: http://api.rubyonrails.org/classes/ActionController/MimeResponds/InstanceMethods.html

+6
source

afaik, .rhtml has long been deprecated.

0
source

Source: https://habr.com/ru/post/1766136/


All Articles