diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-29 18:32:51 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-29 18:32:51 -0700 |
commit | 31752f3516e5977b459cc713ae50515b20fda67b (patch) | |
tree | 9b38077619c2c4d2dcfa84dd3b1c28d3a1f0db55 /actionpack/lib/action_dispatch | |
parent | 7e057d11aa21383394e570d0de8f4d5f3729d024 (diff) | |
download | rails-31752f3516e5977b459cc713ae50515b20fda67b.tar.gz rails-31752f3516e5977b459cc713ae50515b20fda67b.tar.bz2 rails-31752f3516e5977b459cc713ae50515b20fda67b.zip |
avoid creating a block if possible
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0c6e1b37a7..0a888505d2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -345,10 +345,10 @@ module ActionDispatch # Redirect any path to another path: # # match "/stories" => redirect("/posts") - def redirect(*args, &block) + def redirect(*args) options = args.last.is_a?(Hash) ? args.pop : {} - path = args.shift || block + path = args.shift || Proc.new path_proc = path.is_a?(Proc) ? path : proc { |params| (params.empty? || !path.match(/%\{\w*\}/)) ? path : (path % params) } status = options[:status] || 301 |