aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-02-20 22:09:12 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-02-20 22:09:12 +0000
commite1056530665d5c8eed2c325157fbb88553eb2678 (patch)
tree30341bae8b9a63faed289f9dc56c1a654a449731 /actionpack/lib/action_controller/base.rb
parent89cb34c9cfe9d169b79206b74c602e91bc7116a5 (diff)
downloadrails-e1056530665d5c8eed2c325157fbb88553eb2678.tar.gz
rails-e1056530665d5c8eed2c325157fbb88553eb2678.tar.bz2
rails-e1056530665d5c8eed2c325157fbb88553eb2678.zip
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
Diffstat (limited to 'actionpack/lib/action_controller/base.rb')
-rwxr-xr-xactionpack/lib/action_controller/base.rb18
1 files changed, 9 insertions, 9 deletions
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 <tt>app/views</tt> 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 <tt>app/views/guestbook/index.rhtml</tt> by default after populating the <tt>@entries</tt> instance variable.
+ # template <tt>app/views/guestbook/index.erb</tt> by default after populating the <tt>@entries</tt> 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 "<p>Good seeing you!</p>" 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