Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix add_controller_module': undefined method start_with?' for :bloc… #37657

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -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 %r{\A/}.match?(controller)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will reintroduce the deprecation warning fixed in #37504.

We need to avoid the comparison when controller is nil:

Suggested change
if %r{\A/}.match?(controller)
if controller && %r{\A/}.match?(controller)

controller[1..-1]
else
[modyoule, controller].compact.join("/")
Expand Down