mount MyEngine::Engine => '/', :as => 'my_engine'
get 'my_url' => 'MyEngine::Pages#show', :as => :my_url
results in "http://localhost:3000//my_url" (note the incorrect '//')
Is there a reason why you use the suffix "_url" in your route name? BTW I attempted to duplicate this without much luck.
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 …
I think you should mount your engine as
mount MyEngine::Engine => '', :as => 'my_engine'
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'
Right, 1.8 doesn't allows empty strings to be transormed to symbols. If you tried the same in 1.9, it'd work.
fix creating an empty route on 1.8. Closes #1210