Skip to content
Browse files

Merge pull request #10301 from vipulnsward/extract_in_mapper

extract arrays to constants in Mapper
  • Loading branch information...
2 parents ee0d0eb + 8d93b58 commit 4e21b7b359d7c8d2082b641d56a01e85ce9e9d2e @pixeltrix pixeltrix committed Apr 22, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 actionpack/lib/action_dispatch/routing/mapper.rb
View
6 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -945,6 +945,8 @@ module Resources
VALID_ON_OPTIONS = [:new, :collection, :member]
RESOURCE_OPTIONS = [:as, :controller, :path, :only, :except, :param, :concerns]
CANONICAL_ACTIONS = %w(index create new show update destroy)
+ RESOURCE_METHOD_SCOPES = [:collection, :member, :new]
+ RESOURCE_SCOPES = [:resource, :resources]
class Resource #:nodoc:
attr_reader :controller, :path, :options, :param
@@ -1499,11 +1501,11 @@ def scope_action_options #:nodoc:
end
def resource_scope? #:nodoc:
- [:resource, :resources].include? @scope[:scope_level]
+ RESOURCE_SCOPES.include? @scope[:scope_level]
end
def resource_method_scope? #:nodoc:
- [:collection, :member, :new].include? @scope[:scope_level]
+ RESOURCE_METHOD_SCOPES.include? @scope[:scope_level]
end
def with_exclusive_scope

0 comments on commit 4e21b7b

Please sign in to comment.
Something went wrong with that request. Please try again.