Controller can be symbols as well

Symbol doesn't respond to `start_with?` so we need to change it to
string before doing the comparison.
This commit is contained in:
Rafael Mendonça França 2019-11-08 15:51:40 -05:00
parent 063b028190
commit 63256bc5d7
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 2 additions and 2 deletions

@ -355,7 +355,7 @@ def split_to(to)
def add_controller_module(controller, modyoule)
if modyoule && !controller.is_a?(Regexp)
if controller && controller.start_with?("/")
if controller && controller.to_s.start_with?("/")
controller[1..-1]
else
[modyoule, controller].compact.join("/")

@ -4962,7 +4962,7 @@ class TestOptionalScopesWithOrWithoutParams < ActionDispatch::IntegrationTest
app.draw do
scope module: "test_optional_scopes_with_or_without_params" do
scope "(:locale)", locale: /en|es/ do
get "home", to: "home#index"
get "home", controller: :home, action: :index
get "with_param/:foo", to: "home#with_param", as: "with_param"
get "without_param", to: "home#without_param"
end