aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb6
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb5
-rw-r--r--actionpack/lib/action_view/helpers/rendering_helper.rb4
-rw-r--r--actionpack/lib/action_view/renderer/renderer.rb9
-rw-r--r--actionpack/test/controller/routing_test.rb6
5 files changed, 22 insertions, 8 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index db6ff41f55..7f1a790ecc 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -132,11 +132,7 @@ module AbstractController
# Find and renders a template based on the options given.
# :api: private
def _render_template(options) #:nodoc:
- if options.key?(:partial)
- view_renderer.render_partial(view_context, options)
- else
- view_renderer.render_template(view_context, options)
- end
+ view_renderer.render(view_context, options)
end
# The prefixes used in render "foo" shortcuts.
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 1d09091dc7..963a9107da 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -240,6 +240,11 @@ module ActionDispatch
end
def eval_block(block)
+ if block.arity == 1
+ raise "You are using the old router DSL which has been removed in Rails 3.1. " <<
+ "Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/ " <<
+ "or add the rails_legacy_mapper gem to your Gemfile"
+ end
mapper = Mapper.new(self)
if default_scope
mapper.with_default_scope(default_scope, &block)
diff --git a/actionpack/lib/action_view/helpers/rendering_helper.rb b/actionpack/lib/action_view/helpers/rendering_helper.rb
index c91e03b7e8..47efdded42 100644
--- a/actionpack/lib/action_view/helpers/rendering_helper.rb
+++ b/actionpack/lib/action_view/helpers/rendering_helper.rb
@@ -20,10 +20,8 @@ module ActionView
when Hash
if block_given?
view_renderer.render_partial(self, options.merge(:partial => options[:layout]), &block)
- elsif options.key?(:partial)
- view_renderer.render_partial(self, options)
else
- view_renderer.render_template(self, options)
+ view_renderer.render(self, options)
end
else
view_renderer.render_partial(self, :partial => options, :locals => locals)
diff --git a/actionpack/lib/action_view/renderer/renderer.rb b/actionpack/lib/action_view/renderer/renderer.rb
index 3c0126f6bb..1fa51d276f 100644
--- a/actionpack/lib/action_view/renderer/renderer.rb
+++ b/actionpack/lib/action_view/renderer/renderer.rb
@@ -10,6 +10,15 @@ module ActionView
@controller = controller
end
+ # Main render entry point shared by AV and AC.
+ def render(context, options)
+ if options.key?(:partial)
+ render_partial(context, options)
+ else
+ render_template(context, options)
+ end
+ end
+
# Render but returns a valid Rack body. If fibers are defined, we return
# a streaming body that renders the template piece by piece.
#
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 18cf944f46..aa9d193436 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -92,6 +92,12 @@ class LegacyRouteSetTests < Test::Unit::TestCase
@rs.clear!
end
+ def test_draw_with_block_arity_one_raises
+ assert_raise(RuntimeError) do
+ @rs.draw { |map| map.match '/:controller(/:action(/:id))' }
+ end
+ end
+
def test_default_setup
@rs.draw { match '/:controller(/:action(/:id))' }
assert_equal({:controller => "content", :action => 'index'}, rs.recognize_path("/content"))