aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-04-27 18:21:26 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-01 17:31:01 -0700
commit8a4e77b4200946ba4ed42fe5927a7400a846063a (patch)
tree4d61ebd026f32bd9af32c93f93b3071232b1d8ee /actionpack/lib
parent34509777fd375e5bc529f21ca66cf63263c2cf64 (diff)
downloadrails-8a4e77b4200946ba4ed42fe5927a7400a846063a.tar.gz
rails-8a4e77b4200946ba4ed42fe5927a7400a846063a.tar.bz2
rails-8a4e77b4200946ba4ed42fe5927a7400a846063a.zip
OMG, a lot of work
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb5
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb2
-rw-r--r--actionpack/lib/action_controller/dispatch/dispatcher.rb2
-rw-r--r--actionpack/lib/action_controller/dispatch/middlewares.rb2
-rw-r--r--actionpack/lib/action_controller/new_base.rb11
-rw-r--r--actionpack/lib/action_controller/new_base/base.rb2
-rw-r--r--actionpack/lib/action_controller/new_base/compatibility.rb12
7 files changed, 27 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/abstract/layouts.rb b/actionpack/lib/action_controller/abstract/layouts.rb
index 0039e67c5a..315d6151e9 100644
--- a/actionpack/lib/action_controller/abstract/layouts.rb
+++ b/actionpack/lib/action_controller/abstract/layouts.rb
@@ -50,6 +50,7 @@ module AbstractController
end
def _render_template(template, options)
+ # layout = options[:_layout].is_a?(ActionView::Template) ? options[:_layout] : _layout_for_name(options[:_layout])
_action_view._render_template_with_layout(template, options[:_layout])
end
@@ -67,10 +68,10 @@ module AbstractController
def _default_layout(require_layout = false)
if require_layout && !_layout
- raise ArgumentError,
+ raise ArgumentError,
"There was no default layout for #{self.class} in #{view_paths.inspect}"
end
-
+
begin
layout = _layout_for_name(_layout)
rescue NameError => e
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index e31accbbfc..37da2398ec 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -27,9 +27,11 @@ module AbstractController
#
# :api: plugin
def render_to_body(options = {})
+ options = {:_template_name => options} if options.is_a?(String)
name = options[:_template_name] || action_name
template = options[:_template] || view_paths.find_by_parts(name.to_s, {:formats => formats}, options[:_prefix])
+
_render_template(template, options)
end
diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb
index bb9d8bd063..af2da8bfe5 100644
--- a/actionpack/lib/action_controller/dispatch/dispatcher.rb
+++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb
@@ -79,7 +79,7 @@ module ActionController
run_callbacks :before_dispatch
Routing::Routes.call(env)
rescue Exception => exception
- if controller ||= (::ApplicationController rescue Base)
+ if !env["rack.test"] && controller ||= (::ApplicationController rescue Base)
controller.call_with_exception(env, exception).to_a
else
raise exception
diff --git a/actionpack/lib/action_controller/dispatch/middlewares.rb b/actionpack/lib/action_controller/dispatch/middlewares.rb
index b5adbae746..d87c0f9706 100644
--- a/actionpack/lib/action_controller/dispatch/middlewares.rb
+++ b/actionpack/lib/action_controller/dispatch/middlewares.rb
@@ -9,4 +9,4 @@ use lambda { ActionController::Base.session_store },
use "ActionDispatch::ParamsParser"
use "Rack::MethodOverride"
-use "Rack::Head"
+use "Rack::Head" \ No newline at end of file
diff --git a/actionpack/lib/action_controller/new_base.rb b/actionpack/lib/action_controller/new_base.rb
index 7c65f1cdc1..51d9c05a1a 100644
--- a/actionpack/lib/action_controller/new_base.rb
+++ b/actionpack/lib/action_controller/new_base.rb
@@ -1,7 +1,8 @@
module ActionController
- autoload :AbstractBase, "action_controller/new_base/base"
- autoload :HideActions, "action_controller/new_base/hide_actions"
- autoload :Layouts, "action_controller/new_base/layouts"
- autoload :Renderer, "action_controller/new_base/renderer"
- autoload :UrlFor, "action_controller/new_base/url_for"
+ autoload :AbstractBase, "action_controller/new_base/base"
+ autoload :HideActions, "action_controller/new_base/hide_actions"
+ autoload :Layouts, "action_controller/new_base/layouts"
+ autoload :Rails2Compatibility, "action_controller/new_base/compatibility"
+ autoload :Renderer, "action_controller/new_base/renderer"
+ autoload :UrlFor, "action_controller/new_base/url_for"
end \ No newline at end of file
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb
index 08e7a1a0e7..75fe012aed 100644
--- a/actionpack/lib/action_controller/new_base/base.rb
+++ b/actionpack/lib/action_controller/new_base/base.rb
@@ -50,6 +50,8 @@ module ActionController
@_request = ActionDispatch::Request.new(env)
@_response = ActionDispatch::Response.new
process(@_request.parameters[:action])
+ @_response.prepare!
+ self
end
# :api: private
diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb
new file mode 100644
index 0000000000..8682493c8e
--- /dev/null
+++ b/actionpack/lib/action_controller/new_base/compatibility.rb
@@ -0,0 +1,12 @@
+module ActionController
+ module Rails2Compatibility
+
+ def render_to_body(options)
+ if options.is_a?(Hash) && options.key?(:template)
+ options[:template].sub!(/^\//, '')
+ end
+ super
+ end
+
+ end
+end \ No newline at end of file