Mount an engine at the root, with a resource named :items (for example).
mount Example::Engine, :at => '/', :as => 'example' # the bug happens with :at => '' too
Then, on 3.1.0rc5 the expression example.items_path returns //items instead of /items. This completely breaks all links.
Pull requests #2577 fixes it for me.
I forgot to mention: the bug only occurred when calling items_path from outside the engine.
Fix bug #2579.
Avoids double slash at start of paths when mounting an engine at the root.
This issue also seems to happen when accessing request.path from within the engine.
I am also seeing this issue when using request.url and request.fullpath
@rails-noob I see your pull request is now in ActionPack/-Dispatch but it doesn't seem to fix this issue. Any ideas on what the current status of this is since this issue is so old?
I'm still seeing this on request.url when mouting an engine at root, even though #2577 is marked as closed. How can I help with getting this fixed?
We @ Refinery CMS are experiencing the same issue and have to resort to a dirty hack like .sub("//", "/").
@ugisozols - that's what I've resorted to for now (except it's not that simple as you don't want to replace the '//' after 'http:') !
@RicSwirrl we're using it on request.fullpath so that's not a problem.
There's the same kind of dirty hack in Spree too.
@ugisozols unfortunately I need the whole url, as I'm using it as a URI for a resource. :)
@RicSwirrl a regex could do the job AFAIK
@jipiboily That's how I've solved it - but it would be nice if it could be fixed in Rails. It definitely feels like a bug!
Add failing test for #2579.
Fixed by this commit to Journey