Mounting an engine at root path creates double slash at start of URL helper paths #2579

Closed
rails-noob opened this Issue Aug 18, 2011 · 14 comments

Comments

Projects
None yet
7 participants
@rails-noob

Mount an engine at the root, with a resource named :items (for example).

  #config/routes.rb
  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.

@rails-noob

This comment has been minimized.

Show comment
Hide comment
@rails-noob

rails-noob Aug 18, 2011

I forgot to mention: the bug only occurred when calling items_path from outside the engine.

I forgot to mention: the bug only occurred when calling items_path from outside the engine.

@rails-noob rails-noob closed this Aug 18, 2011

@rails-noob rails-noob reopened this Aug 18, 2011

rails-noob pushed a commit to rails-noob/rails that referenced this issue Sep 6, 2011

rails-noob
Fix bug #2579.
Avoids double slash at start of paths when mounting an engine at the root.
@joelmats

This comment has been minimized.

Show comment
Hide comment
@joelmats

joelmats Dec 16, 2011

This issue also seems to happen when accessing request.path from within the engine.

This issue also seems to happen when accessing request.path from within the engine.

@dlindahl

This comment has been minimized.

Show comment
Hide comment
@dlindahl

dlindahl Jan 23, 2012

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 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?

@RicSwirrl

This comment has been minimized.

Show comment
Hide comment
@RicSwirrl

RicSwirrl Mar 7, 2012

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?

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?

@ugisozols

This comment has been minimized.

Show comment
Hide comment
@ugisozols

ugisozols Mar 7, 2012

Contributor

We @ Refinery CMS are experiencing the same issue and have to resort to a dirty hack like .sub("//", "/").

Contributor

ugisozols commented Mar 7, 2012

We @ Refinery CMS are experiencing the same issue and have to resort to a dirty hack like .sub("//", "/").

@RicSwirrl

This comment has been minimized.

Show comment
Hide comment
@RicSwirrl

RicSwirrl Mar 7, 2012

@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:') !

@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:') !

@ugisozols

This comment has been minimized.

Show comment
Hide comment
@ugisozols

ugisozols Mar 7, 2012

Contributor

@RicSwirrl we're using it on request.fullpath so that's not a problem.

Contributor

ugisozols commented Mar 7, 2012

@RicSwirrl we're using it on request.fullpath so that's not a problem.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily Mar 7, 2012

Contributor

There's the same kind of dirty hack in Spree too.

Contributor

jipiboily commented Mar 7, 2012

There's the same kind of dirty hack in Spree too.

@RicSwirrl

This comment has been minimized.

Show comment
Hide comment
@RicSwirrl

RicSwirrl Mar 7, 2012

@ugisozols unfortunately I need the whole url, as I'm using it as a URI for a resource. :)

@ugisozols unfortunately I need the whole url, as I'm using it as a URI for a resource. :)

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily Mar 7, 2012

Contributor

@RicSwirrl a regex could do the job AFAIK

Contributor

jipiboily commented Mar 7, 2012

@RicSwirrl a regex could do the job AFAIK

@RicSwirrl

This comment has been minimized.

Show comment
Hide comment
@RicSwirrl

RicSwirrl Mar 7, 2012

@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!

@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!

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily Mar 7, 2012

Contributor

@RicSwirrl agree!

Contributor

jipiboily commented Mar 7, 2012

@RicSwirrl agree!

@pixeltrix

This comment has been minimized.

Show comment
Hide comment
@pixeltrix

pixeltrix Mar 12, 2012

Member

Fixed by this commit to Journey

Member

pixeltrix commented Mar 12, 2012

Fixed by this commit to Journey

@pixeltrix pixeltrix closed this Mar 12, 2012

@RicSwirrl

This comment has been minimized.

Show comment
Hide comment
@RicSwirrl

RicSwirrl Mar 12, 2012

Teh Awesomez.

Teh Awesomez.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment