From e1056530665d5c8eed2c325157fbb88553eb2678 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 20 Feb 2007 22:09:12 +0000 Subject: Added .erb and .builder as preferred aliases to the now deprecated .rhtml and .rxml extensions [Chad Fowler]. This is done to separate the renderer from the mime type. .erb templates are often used to render emails, atom, csv, whatever. So labeling them .rhtml doesn't make too much sense. The same goes for .rxml, which can be used to build everything from HTML to Atom to whatever. .rhtml and .rxml will continue to work until Rails 3.0, though. So this is a slow phasing out. All generators and examples will start using the new aliases, though. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_controller/base.rb') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 360e115f16..39ffb06212 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -71,7 +71,7 @@ module ActionController #:nodoc: # # Actions, by default, render a template in the app/views directory corresponding to the name of the controller and action # after executing code in the action. For example, the +index+ action of the +GuestBookController+ would render the - # template app/views/guestbook/index.rhtml by default after populating the @entries instance variable. + # template app/views/guestbook/index.erb by default after populating the @entries instance variable. # # Unlike index, the sign action will not render a template. After performing its main purpose (creating a # new entry in the guest book), it initiates a redirect instead. This redirect works by returning an external @@ -662,7 +662,7 @@ module ActionController #:nodoc: # Template rendering works just like action rendering except that it takes a path relative to the template root. # The current layout is automatically applied. # - # # Renders the template located in [TEMPLATE_ROOT]/weblog/show.r(html|xml) (in Rails, app/views/weblog/show.rhtml) + # # Renders the template located in [TEMPLATE_ROOT]/weblog/show.r(html|xml) (in Rails, app/views/weblog/show.erb) # render :template => "weblog/show" # # === Rendering a file @@ -671,12 +671,12 @@ module ActionController #:nodoc: # is assumed to be absolute, and the current layout is not applied. # # # Renders the template located at the absolute filesystem path - # render :file => "/path/to/some/template.rhtml" - # render :file => "c:/path/to/some/template.rhtml" + # render :file => "/path/to/some/template.erb" + # render :file => "c:/path/to/some/template.erb" # # # Renders a template within the current layout, and with a 404 status code - # render :file => "/path/to/some/template.rhtml", :layout => true, :status => 404 - # render :file => "c:/path/to/some/template.rhtml", :layout => true, :status => 404 + # render :file => "/path/to/some/template.erb", :layout => true, :status => 404 + # render :file => "c:/path/to/some/template.erb", :layout => true, :status => 404 # # # Renders a template relative to the template root and chooses the proper file extension # render :file => "some/template", :use_full_path => true @@ -734,7 +734,7 @@ module ActionController #:nodoc: # render :inline => "<%= 'hello, ' * 3 + 'again' %>" # # # Renders "

Good seeing you!

" using Builder - # render :inline => "xml.p { 'Good seeing you!' }", :type => :rxml + # render :inline => "xml.p { 'Good seeing you!' }", :type => :builder # # # Renders "hello david" # render :inline => "<%= 'hello ' + name %>", :locals => { :name => "david" } @@ -863,7 +863,7 @@ module ActionController #:nodoc: render_text(@template.render_file(template_path, use_full_path, locals), status) end - def render_template(template, status = nil, type = :rhtml, local_assigns = {}) #:nodoc: + def render_template(template, status = nil, type = :erb, local_assigns = {}) #:nodoc: add_variables_to_assigns render_text(@template.render_template(type, template, nil, local_assigns), status) end @@ -1252,7 +1252,7 @@ module ActionController #:nodoc: def assert_existence_of_template_file(template_name) unless template_exists?(template_name) || ignore_missing_templates - full_template_path = @template.send(:full_template_path, template_name, 'rhtml') + full_template_path = @template.send(:full_template_path, template_name, 'erb') template_type = (template_name =~ /layouts/i) ? 'layout' : 'template' raise(MissingTemplate, "Missing #{template_type} #{full_template_path}") end -- cgit v1.2.3