diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-13 18:42:26 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-13 18:42:26 -0700 |
commit | 318eea062ec3aa95929cfb516a273e732e22a9d1 (patch) | |
tree | 0a36b4572c23e5d2952aa132931bdbb6e46241dd /actionpack/lib/action_dispatch | |
parent | 3b908cba28552604f8d85a236f2d1c82f7589d80 (diff) | |
download | rails-318eea062ec3aa95929cfb516a273e732e22a9d1.tar.gz rails-318eea062ec3aa95929cfb516a273e732e22a9d1.tar.bz2 rails-318eea062ec3aa95929cfb516a273e732e22a9d1.zip |
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"
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index e977d769e0..a3a22bceb1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1634,8 +1634,8 @@ module ActionDispatch 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 @@ module ActionDispatch @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 @@ module ActionDispatch 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)}" |