From 374d66be3e9e994bbe8ad2702ee2209c24b581b0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 13 Aug 2014 19:40:57 -0700 Subject: reduce calls to scope_level this will help us to encapsulate magical symbols so hopefully we can eliminate hardcoded magic symbols --- actionpack/lib/action_dispatch/routing/mapper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 209af7a16d..46d83f7fd7 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1563,7 +1563,7 @@ module ActionDispatch raise ArgumentError, "must be called with a path and/or options" end - if @scope.scope_level == :resources + if @scope.resources? with_scope_level(:root) do scope(parent_resource.path) do super(options) @@ -1913,6 +1913,10 @@ module ActionDispatch scope_level == :nested end + def resources? + scope_level == :resources + end + def resource_scope? RESOURCE_SCOPES.include? scope_level end -- cgit v1.2.3