diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-09 20:46:32 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-09 20:46:32 -0600 |
commit | ec5434c3c2631bb47b568eede397c3bd596eeb88 (patch) | |
tree | 55f7f9c4e41590e587535d23498a610290bcecee /actionpack/lib | |
parent | b2ef6d13f0a0b3d07b8a2f9a1ec64988ba7e4392 (diff) | |
download | rails-ec5434c3c2631bb47b568eede397c3bd596eeb88.tar.gz rails-ec5434c3c2631bb47b568eede397c3bd596eeb88.tar.bz2 rails-ec5434c3c2631bb47b568eede397c3bd596eeb88.zip |
Check block arity passed to routes draw so you don't need to use
|map|
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index a8073c2105..0e83ea3b7e 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -216,7 +216,14 @@ module ActionDispatch 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 |