Permalink
Browse files

Simplify constraints condition in scope when checking for Hash

  • Loading branch information...
1 parent b69fd47 commit 5b9f983c65dcca590d5ff309cea4def61209790d @carlosantoniodasilva carlosantoniodasilva committed Nov 23, 2012
Showing with 4 additions and 7 deletions.
  1. +4 −7 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -641,19 +641,16 @@ module Scoping
# resources :posts
# end
def scope(*args)
- options = args.extract_options!
- options = options.dup
-
- options[:path] = args.flatten.join('/') if args.any?
+ options = args.extract_options!.dup
recover = {}
+ options[:path] = args.flatten.join('/') if args.any?
options[:constraints] ||= {}
- unless options[:constraints].is_a?(Hash)
- block, options[:constraints] = options[:constraints], {}
- end
if options[:constraints].is_a?(Hash)
(options[:defaults] ||= {}).reverse_merge!(defaults_from_constraints(options[:constraints]))
+ else
+ block, options[:constraints] = options[:constraints], {}
end
scope_options.each do |option|

0 comments on commit 5b9f983

Please sign in to comment.