Permalink
Browse files

Merge pull request #377 from joshk/rails_legacy_mapper_message.

raise an error if the old router draw method is used
  • Loading branch information...
2 parents 7ae3b82 + 2755294 commit f82767e276b7f6fcd7c0770348cb8f1716365dba @josevalim josevalim committed May 3, 2011
Showing with 11 additions and 0 deletions.
  1. +5 −0 actionpack/lib/action_dispatch/routing/route_set.rb
  2. +6 −0 actionpack/test/controller/routing_test.rb
@@ -240,6 +240,11 @@ def append(&block)
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)
@@ -92,6 +92,12 @@ def teardown
@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"))

0 comments on commit f82767e

Please sign in to comment.