aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/layout.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-05-22 08:58:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-05-22 08:58:43 +0000
commitda0c4c5c9695e2ebe8d98b391d901b598dd293a2 (patch)
tree09894a8d950e73e0a51698e6657c131592ee9ee6 /actionpack/lib/action_controller/layout.rb
parent0367317dd62ecd177d57d469a4d57974b75e425b (diff)
downloadrails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.tar.gz
rails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.tar.bz2
rails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.zip
Deprecated all render_* methods in favor of consolidating all rendering behavior in Base#render(options). This enables more natural use of combining options, such as layouts
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1350 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/layout.rb')
-rw-r--r--actionpack/lib/action_controller/layout.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb
index 37dba36186..d6423fdbff 100644
--- a/actionpack/lib/action_controller/layout.rb
+++ b/actionpack/lib/action_controller/layout.rb
@@ -6,9 +6,6 @@ module ActionController #:nodoc:
alias_method :render_without_layout, :render
alias_method :render, :render_with_layout
- alias_method :r_without_layout, :r
- alias_method :r, :r_with_layout
-
class << self
alias_method :inherited_without_layout, :inherited
end
@@ -205,7 +202,7 @@ module ActionController #:nodoc:
active_layout.include?("/") ? active_layout : "layouts/#{active_layout}" if active_layout
end
- def render_with_layout(template_name = default_template_name, status = nil, layout = nil) #:nodoc:
+ def xrender_with_layout(template_name = default_template_name, status = nil, layout = nil) #:nodoc:
if layout ||= active_layout and action_has_layout?
add_variables_to_assigns
logger.info("Rendering #{template_name} within #{layout}") unless logger.nil?
@@ -216,23 +213,25 @@ module ActionController #:nodoc:
end
end
- def r_with_layout(options = {})
- if (layout = active_layout_for_r(options)) && options[:text]
+ def render_with_layout(options = {}, deprecated_status = nil, deprecated_layout = nil)
+ if (layout = active_layout_for_r(options, deprecated_layout)) && options[:text]
add_variables_to_assigns
logger.info("Rendering #{template_name} within #{layout}") unless logger.nil?
- @content_for_layout = r_without_layout(options)
+ @content_for_layout = render_without_layout(options)
add_variables_to_assigns
erase_render_results
- r_without_layout(options.merge({ :text => @template.render_file(layout, true)}))
+ render_without_layout(options.merge({ :text => @template.render_file(layout, true), :status => options[:status] || deprecated_status }))
else
- r_without_layout(options)
+ render_without_layout(options, deprecated_status)
end
end
private
- def active_layout_for_r(options = {})
+ def active_layout_for_r(options = {}, deprecated_layout = nil)
+ return deprecated_layout unless deprecated_layout.nil?
+
case options[:layout]
when FalseClass
nil
@@ -244,7 +243,7 @@ module ActionController #:nodoc:
end
def action_has_layout?
- conditions = self.class.layout_conditions
+ conditions = self.class.layout_conditions || {}
case
when conditions[:only]
conditions[:only].include?(action_name)