Skip to content

Regression in URL generation in Rails 7.1 #51910

@adrianthedev

Description

@adrianthedev

Hi,

I think I found a regression/bug in Rails 7.1

Context

We, at Avo use one main engine but also have a few smaller ones alongside it to bring new features.

The issue consists in the fact that URLs that are generated and displayed in the initial, parent engine (avo), for the second engine do not contain the mount path of the first one.

What happens is:

  • avo engine gets mounted on /avo
  • pro engine gets mounted in the avo engine on /pro
  • the expectation is that any route we call on the pro engine should be generated with the /avo prefix

*That is the way it worked on 7.0

Steps to reproduce

https://gist.github.com/adrianthedev/ab57557950a05804532377b69185d866

The script should be executed with the RAILS_VERSON env variable like so:

# run with rails 7.0.8.3 (last 7.0 version) and see the tests pass
RAILS_VERSION=7.0.8.3 ruby repro.rb

# run with rails 7.1 and see the tests fail
RAILS_VERSION=7.1.0 ruby repro.rb

Expected behavior

The generated URL should contain the /avo prefix in both 7.0 and 7.1.

Actual behavior

The generated URL does not contain the /avo prefix in Rails 7.1.

System configuration

Rails version: 7.0 and 7.1

Ruby version: 3.3.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions