aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/rendering.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-24 01:33:18 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-24 01:33:18 +0530
commitefd0bd3b7390ebb8526b981169025f2860f6a113 (patch)
tree1cb3bcd8f9534f64e8a764af1010ce65303b42b0 /actionpack/lib/action_controller/metal/rendering.rb
parentf4571e3617ccd9cc9e5ee9f7431066bd80395e22 (diff)
parent8ff2fb6f3aa6140f5a8bd018d5919a8a1e707cda (diff)
downloadrails-efd0bd3b7390ebb8526b981169025f2860f6a113.tar.gz
rails-efd0bd3b7390ebb8526b981169025f2860f6a113.tar.bz2
rails-efd0bd3b7390ebb8526b981169025f2860f6a113.zip
Merge remote branch 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_controller/metal/rendering.rb')
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb43
1 files changed, 28 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index 74e50bb032..72e2bbd00e 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -12,9 +12,10 @@ module ActionController
super
end
- def render(options)
- super
- self.content_type ||= options[:_template].mime_type.to_s
+ def render(*args)
+ args << {} unless args.last.is_a?(Hash)
+ super(*args)
+ self.content_type ||= args.last[:_template].mime_type.to_s
response_body
end
@@ -24,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
@@ -53,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