aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-22 17:57:36 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-22 17:58:03 +0100
commitd618b7e3dcf2fe6040f025c02bf29691aefc8a71 (patch)
treedbc1f6b1c6e2f584cd4ef221240998052bf4c7ef /actionpack/lib/action_controller
parentcc6f16685ca68900720e5813bd2adca078428f2e (diff)
downloadrails-d618b7e3dcf2fe6040f025c02bf29691aefc8a71.tar.gz
rails-d618b7e3dcf2fe6040f025c02bf29691aefc8a71.tar.bz2
rails-d618b7e3dcf2fe6040f025c02bf29691aefc8a71.zip
Ensure strings given to render with slash are rendered relative to the configured _prefix.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb23
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb36
2 files changed, 24 insertions, 35 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index a66aafd80e..f46231d72b 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -81,28 +81,5 @@ module ActionController
filter << block if block
filter
end
-
- def _normalize_options(action=nil, options={}, &blk)
- case action
- when NilClass
- when Hash, String
- options = super
- when Symbol
- options.merge! :action => action
- else
- options.merge! :partial => action
- end
-
- if options.key?(:action) && options[:action].to_s.index("/")
- options[:template] = options.delete(:action)
- end
-
- if options[:status]
- options[:status] = Rack::Utils.status_code(options[:status])
- end
-
- options[:update] = blk if block_given?
- options
- end
end
end
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index 475ed54167..72e2bbd00e 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -25,18 +25,6 @@ module ActionController
end
private
- def _prefix
- controller_path
- end
-
- def _determine_template(options)
- if (options.keys & [:partial, :file, :template, :text, :inline]).empty?
- options[:_template_name] ||= options[:action]
- options[:_prefix] = _prefix
- end
-
- super
- end
def _render_partial(options)
options[:partial] = action_name if options[:partial] == true
@@ -54,5 +42,29 @@ module ActionController
self.content_type = content_type if content_type
self.headers["Location"] = url_for(location) if location
end
+
+ def _normalize_options(action=nil, options={}, &blk)
+ case action
+ when NilClass
+ when Hash
+ options = super(action.delete(:action), action)
+ when String, Symbol
+ options = super
+ else
+ options.merge! :partial => action
+ end
+
+ if (options.keys & [:partial, :file, :template, :text, :inline]).empty?
+ options[:_template_name] ||= options[:action]
+ options[:_prefix] = _prefix
+ end
+
+ if options[:status]
+ options[:status] = Rack::Utils.status_code(options[:status])
+ end
+
+ options[:update] = blk if block_given?
+ options
+ end
end
end