diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index fdcfe26781..8a161b0837 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -620,18 +620,9 @@ module ActionDispatch end def actions - only, except = @options.values_at(:only, :except) - if only == :all || except == :none - only = nil - except = [] - elsif only == :none || except == :all - only = [] - except = nil - end - - if only + if only = @options[:only] Array(only).map(&:to_sym) - elsif except + elsif except = @options[:except] default_actions - Array(except).map(&:to_sym) else default_actions @@ -783,7 +774,7 @@ module ActionDispatch end resource_scope(Resource.new(resources.pop, options)) do - instance_eval(&block) if block_given? + yield if block_given? collection_scope do get :index if parent_resource.actions.include?(:index) @@ -907,15 +898,6 @@ module ActionDispatch return self end - via = Array.wrap(options[:via]).map(&:to_sym) - if via.include?(:head) - raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" - end - - unless (invalid = via - HTTP_METHODS).empty? - raise ArgumentError, "Invalid HTTP method (#{invalid.join(', ')}) specified in :via" - end - on = options.delete(:on) if VALID_ON_OPTIONS.include?(on) args.push(options) |