aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-01-23 19:45:25 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-01-23 19:45:25 +1100
commit1ea84c38ea5b40642f3dcdb5ffca1c6fc9cc604d (patch)
tree750e10199be244bb5676ea615dbf49dee38b7fd4 /actionpack/lib/abstract_controller
parentbd24c75fc619fa80af03662cc4dd18fc9b70cafb (diff)
parent8ff2fb6f3aa6140f5a8bd018d5919a8a1e707cda (diff)
downloadrails-1ea84c38ea5b40642f3dcdb5ffca1c6fc9cc604d.tar.gz
rails-1ea84c38ea5b40642f3dcdb5ffca1c6fc9cc604d.tar.bz2
rails-1ea84c38ea5b40642f3dcdb5ffca1c6fc9cc604d.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb37
1 files changed, 25 insertions, 12 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 826e82c8c6..a168b1b4c5 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -98,18 +98,9 @@ module AbstractController
_view_paths
end
- # Normalize options, by converting render "foo" to render :template => "foo"
- # and render "/foo" to render :file => "/foo".
- def _normalize_options(action=nil, options={})
- case action
- when Hash
- options, action = action, nil
- when String
- key = (action.index("/") == 0 ? :file : :template)
- options.merge!(key => action)
- end
-
- options
+ # The prefix used in render "foo" shortcuts.
+ def _prefix
+ controller_path
end
# Return a string representation of a Rack-compatible response body.
@@ -126,6 +117,28 @@ module AbstractController
private
+ # Normalize options, by converting render "foo" to render :template => "prefix/foo"
+ # and render "/foo" to render :file => "/foo".
+ def _normalize_options(action=nil, options={})
+ case action
+ when Hash
+ options, action = action, nil
+ when String, Symbol
+ action = action.to_s
+ case action.index("/")
+ when NilClass
+ options[:_prefix] = _prefix
+ options[:_template_name] = action
+ when 0
+ options[:file] = action
+ else
+ options[:template] = action
+ end
+ end
+
+ options
+ end
+
# Take in a set of options and determine the template to render
#
# ==== Options