From 304906f1bd4cd6f2831b6ae39a9ae54599d85569 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Mon, 5 Mar 2018 20:21:27 +0200 Subject: Introduce `ActionDispatch::Routing::ConsoleFormatter::Base` - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130 --- railties/lib/rails/commands/routes/routes_command.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/routes/routes_command.rb b/railties/lib/rails/commands/routes/routes_command.rb index c4f3717095..25ee65aeaa 100644 --- a/railties/lib/rails/commands/routes/routes_command.rb +++ b/railties/lib/rails/commands/routes/routes_command.rb @@ -36,13 +36,7 @@ module Rails private def routes_filter - if options.has_key?("controller") - { controller: options["controller"] } - elsif options.has_key?("grep_pattern") - options["grep_pattern"] - else - nil - end + options.symbolize_keys.slice(:controller, :grep_pattern) end end end -- cgit v1.2.3