Skip to content
This repository
Browse code

Merge pull request #377 from joshk/rails_legacy_mapper_message.

raise an error if the old router draw method is used
  • Loading branch information...
commit f82767e276b7f6fcd7c0770348cb8f1716365dba 2 parents 7ae3b82 + 2755294
José Valim josevalim authored
5 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -240,6 +240,11 @@ def append(&block)
240 240 end
241 241
242 242 def eval_block(block)
  243 + if block.arity == 1
  244 + raise "You are using the old router DSL which has been removed in Rails 3.1. " <<
  245 + "Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/ " <<
  246 + "or add the rails_legacy_mapper gem to your Gemfile"
  247 + end
243 248 mapper = Mapper.new(self)
244 249 if default_scope
245 250 mapper.with_default_scope(default_scope, &block)
6 actionpack/test/controller/routing_test.rb
@@ -92,6 +92,12 @@ def teardown
92 92 @rs.clear!
93 93 end
94 94
  95 + def test_draw_with_block_arity_one_raises
  96 + assert_raise(RuntimeError) do
  97 + @rs.draw { |map| map.match '/:controller(/:action(/:id))' }
  98 + end
  99 + end
  100 +
95 101 def test_default_setup
96 102 @rs.draw { match '/:controller(/:action(/:id))' }
97 103 assert_equal({:controller => "content", :action => 'index'}, rs.recognize_path("/content"))

0 comments on commit f82767e

Please sign in to comment.
Something went wrong with that request. Please try again.