helpers generate incorrect URLs when engine mounted on root #1210

tomasc opened this Issue May 22, 2011 · 5 comments


None yet
4 participants

tomasc commented May 22, 2011

main_app routes.rb

mount MyEngine::Engine => '/', :as => 'my_engine'

my_engine's routes.rb

get 'my_url' => 'MyEngine::Pages#show', :as => :my_url

in views:


results in "http://localhost:3000//my_url" (note the incorrect '//')


farleyknight commented Jun 1, 2011

Is there a reason why you use the suffix "_url" in your route name? BTW I attempted to duplicate this without much luck.

tomasc commented Jun 1, 2011

the _url is just a naming, not actual generator (as for example _path or _url). i should have chosen better name.
perhaps i also forgot to say, that the engine is not isolated.
i will try to look for some example on which to show this issue …


dmathieu commented Jun 1, 2011

I think you should mount your engine as

mount MyEngine::Engine => '', :as => 'my_engine'

tomasc commented Jun 1, 2011

yes, that would make sense, right? unfortunately:

/Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:1426:in `to_sym': interning empty string (ArgumentError)
    from /Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:1426:in `action_path'
    from /Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:1421:in `path_for_action'
    from /Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:1276:in `match'
    from /Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:1477:in `match'
    from /Library/Ruby/Gems/1.8/bundler/gems/rails-82857adc56ef/actionpack/lib/action_dispatch/routing/mapper.rb:420:in `mount'

dmathieu commented Jun 1, 2011

Right, 1.8 doesn't allows empty strings to be transormed to symbols. If you tried the same in 1.9, it'd work.

@drogus drogus closed this in 0459374 Jun 1, 2011

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