aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-04-29 17:32:39 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-01 17:31:02 -0700
commit49834e088bf8d02a4f75793a42868f2aea8749a4 (patch)
tree314643bcdaabd64780f027756ca4710c6a2d72ac /actionpack/lib
parent0c3d9bc4c2b329cb754bfed1e465f99d058e1193 (diff)
downloadrails-49834e088bf8d02a4f75793a42868f2aea8749a4.tar.gz
rails-49834e088bf8d02a4f75793a42868f2aea8749a4.tar.bz2
rails-49834e088bf8d02a4f75793a42868f2aea8749a4.zip
Support implicit render and blank render
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/abstract/base.rb13
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb4
-rw-r--r--actionpack/lib/action_controller/new_base/renderer.rb9
3 files changed, 15 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/abstract/base.rb b/actionpack/lib/action_controller/abstract/base.rb
index ade7719cc0..a87a490a2d 100644
--- a/actionpack/lib/action_controller/abstract/base.rb
+++ b/actionpack/lib/action_controller/abstract/base.rb
@@ -29,10 +29,21 @@ module AbstractController
private
+ # It is possible for respond_to?(action_name) to be false and
+ # respond_to?(:action_missing) to be false if respond_to_action?
+ # is overridden in a subclass. For instance, ActionController::Base
+ # overrides it to include the case where a template matching the
+ # action_name is found.
def process_action
- respond_to?(action_name) ? send(action_name) : send(:action_missing, action_name)
+ if respond_to?(action_name) then send(action_name)
+ elsif respond_to?(:action_missing, true) then send(:action_missing, action_name)
+ end
end
+ # Override this to change the conditions that will raise an
+ # ActionNotFound error. If you accept a difference case,
+ # you must handle it by also overriding process_action and
+ # handling the case.
def respond_to_action?(action_name)
respond_to?(action_name) || respond_to?(:action_missing, true)
end
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index e9a7ab4004..716b213c75 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -42,9 +42,9 @@ module AbstractController
def render_to_body(options = {})
name = options[:_template_name] || action_name
- template = options[:_template] || view_paths.find_by_parts(name.to_s, {:formats => formats}, options[:_prefix])
+ options[:_template] ||= view_paths.find_by_parts(name.to_s, {:formats => formats}, options[:_prefix])
- _render_template(template, options)
+ _render_template(options[:_template], options)
end
# Raw rendering of a template to a string.
diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb
index df07edbd90..096a63e406 100644
--- a/actionpack/lib/action_controller/new_base/renderer.rb
+++ b/actionpack/lib/action_controller/new_base/renderer.rb
@@ -7,14 +7,7 @@ module ActionController
super
end
- def render(action, options = {})
- # TODO: Move this into #render_to_body
- if action.is_a?(Hash)
- options, action = action, nil
- else
- options.merge! :action => action
- end
-
+ def render(options = {})
_process_options(options)
super(options)