Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pass consistent parameters to canonical_action?

now we only have to look up @scope[:scope_level] once per call to
canonical_action? and we don't have a variable named "flag"
  • Loading branch information...
commit 318eea062ec3aa95929cfb516a273e732e22a9d1 1 parent 3b908cb
Aaron Patterson tenderlove authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 actionpack/lib/action_dispatch/routing/mapper.rb
10 actionpack/lib/action_dispatch/routing/mapper.rb
View
@@ -1634,8 +1634,8 @@ def resource_scope? #:nodoc:
RESOURCE_SCOPES.include? @scope[:scope_level]
end
- def resource_method_scope? #:nodoc:
- RESOURCE_METHOD_SCOPES.include? @scope[:scope_level]
+ def resource_method_scope?(scope_level) #:nodoc:
+ RESOURCE_METHOD_SCOPES.include? scope_level
end
def nested_scope? #:nodoc:
@@ -1699,8 +1699,8 @@ def param_constraint #:nodoc:
@scope[:constraints][parent_resource.param]
end
- def canonical_action?(action, flag) #:nodoc:
- flag && resource_method_scope? && CANONICAL_ACTIONS.include?(action.to_s)
+ def canonical_action?(action, scope_level) #:nodoc:
+ scope_level && resource_method_scope?(scope_level) && CANONICAL_ACTIONS.include?(action.to_s)
end
def shallow_scope(path, options = {}) #:nodoc:
@@ -1714,7 +1714,7 @@ def shallow_scope(path, options = {}) #:nodoc:
end
def path_for_action(action, path) #:nodoc:
- if canonical_action?(action, path.blank?)
+ if path.blank? && canonical_action?(action, @scope[:scope_level])
@scope[:path].to_s
else
"#{@scope[:path]}/#{action_path(action, path)}"
Please sign in to comment.
Something went wrong with that request. Please try again.