Skip to content

Commit

Permalink
Controller can be symbols as well
Browse files Browse the repository at this point in the history
Symbol doesn't respond to `start_with?` so we need to change it to
string before doing the comparison.
  • Loading branch information
rafaelfranca committed Dec 3, 2019
1 parent c3135a4 commit 6629ed7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,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("/")
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4964,7 +4964,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
Expand Down

0 comments on commit 6629ed7

Please sign in to comment.