From 02e821f329bec116ca367886233d16feae6723ef Mon Sep 17 00:00:00 2001 From: claudiob Date: Thu, 20 Nov 2014 14:44:56 -0800 Subject: Wrap code snippets in +, not backticks, in sdoc [ci skip] --- actionpack/lib/action_dispatch/routing/mapper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ac03ecb2c8..be54d43172 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -391,7 +391,7 @@ module ActionDispatch # Matches a url pattern to one or more routes. # - # You should not use the `match` method in your router + # You should not use the +match+ method in your router # without specifying an HTTP method. # # If you want to expose your action to both GET and POST, use: @@ -402,7 +402,7 @@ module ActionDispatch # Note that +:controller+, +:action+ and +:id+ are interpreted as url # query parameters and thus available through +params+ in an action. # - # If you want to expose your action to GET, use `get` in the router: + # If you want to expose your action to GET, use +get+ in the router: # # Instead of: # @@ -457,7 +457,7 @@ module ActionDispatch # The route's action. # # [:param] - # Overrides the default resource identifier `:id` (name of the + # Overrides the default resource identifier +:id+ (name of the # dynamic segment used to generate the routes). # You can access that segment from your controller using # params[<:param>]. -- cgit v1.2.3 From 9530c5786e621bcafa68a2eab3021ccd9a930e52 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Wed, 26 Nov 2014 13:28:59 +0100 Subject: Refactor nested if --- actionpack/lib/action_dispatch/routing/mapper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index be54d43172..a8be77f46d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -244,12 +244,10 @@ module ActionDispatch def app(blocks) if to.respond_to?(:call) Constraints.new(to, blocks, false) + elsif blocks.any? + Constraints.new(dispatcher(defaults), blocks, true) else - if blocks.any? - Constraints.new(dispatcher(defaults), blocks, true) - else - dispatcher(defaults) - end + dispatcher(defaults) end end -- cgit v1.2.3 From f413cbee8dd702e2cae550c04b16e6c98411aeab Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Fri, 28 Nov 2014 14:58:10 -0500 Subject: Pure rack apps can be mounted with a name See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492 --- actionpack/lib/action_dispatch/routing/mapper.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a8be77f46d..5040aa82b2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -580,13 +580,7 @@ module ActionDispatch raise "A rack application must be specified" unless path rails_app = rails_app? app - - if rails_app - options[:as] ||= app.railtie_name - else - # non rails apps can't have an :as - options[:as] = nil - end + options[:as] ||= app.railtie_name if rails_app target_as = name_for_action(options[:as], path) options[:via] ||= :all -- cgit v1.2.3