Permalink
Browse files

Check block arity passed to routes draw so you don't need to use

|map|
  • Loading branch information...
1 parent b2ef6d1 commit ec5434c3c2631bb47b568eede397c3bd596eeb88 @josh josh committed Dec 10, 2009
Showing with 9 additions and 2 deletions.
  1. +8 −1 actionpack/lib/action_dispatch/routing/route_set.rb
  2. +1 −1 actionpack/test/dispatch/routing_test.rb
@@ -216,7 +216,14 @@ def initialize
def draw(&block)
clear!
- Mapper.new(self).instance_exec(DeprecatedMapper.new(self), &block)
+
+ mapper = Mapper.new(self)
+ if block.arity == 1
+ mapper.instance_exec(DeprecatedMapper.new(self), &block)
+ else
+ mapper.instance_exec(&block)
+ end
+
@set.add_route(NotFound)
install_helpers
@set.freeze
@@ -14,7 +14,7 @@ def self.matches?(request)
stub_controllers do |routes|
Routes = routes
- Routes.draw do |map|
+ Routes.draw do
controller :sessions do
get 'login', :to => :new, :as => :login
post 'login', :to => :create

0 comments on commit ec5434c

Please sign in to comment.