Skip to content
This repository

Mounting an engine at root path. #2131

Closed
nasa42 opened this Issue · 6 comments

4 participants

Vikrant Chaudhary Andrew White Guillermo Iguaran rails-noob
Vikrant Chaudhary
nasa42 commented

Using Rails 3.1.0.rc4, I can mount an engine at root using following -

  #config/routes.rb
  mount Example::Engine, :at => '/', :as => 'example'

While everything just works, the problem is that request.url inside controller/action returns URLs in format http://127.0.0.1:3000//path/from/engine (notice double forward slashes) which makes redirecting back (and other stuff) a 404.

Also when I try to mount the engine using following -

  #config/routes.rb
  mount Example::Engine, :at => "", :as => 'example'

I get error -
actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1426:in `to_sym': interning empty string (ArgumentError)
Would you like me to paste the whole call stack?

Guillermo Iguaran
Owner

Please paste stack, I will check it

Vikrant Chaudhary
nasa42 commented

ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
Ubuntu 11.04 amd64

<path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1426:in `to_sym': interning empty string (ArgumentError)
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1426:in `action_path'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1421:in `path_for_action'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1276:in `match'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:1477:in `match'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/mapper.rb:420:in `mount'
    from <path>/config/routes.rb:6
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/route_set.rb:257:in `instance_exec'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/route_set.rb:257:in `eval_block'
    from <path>/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_dispatch/routing/route_set.rb:234:in `draw'
    from <path>/config/routes.rb:1
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/routes_reloader.rb:29:in `each'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/routes_reloader.rb:13:in `reload!'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/routes_reloader.rb:7:in `initialize'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/file_update_checker.rb:32:in `call'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/finisher.rb:63
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/finisher.rb:64:in `call'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application/finisher.rb:64
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `instance_exec'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `run'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:50:in `run_initializers'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `each'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `run_initializers'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/application.rb:96:in `initialize!'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `send'
    from <path>/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from <path>/config/environment.rb:5
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
    from <path>/vendor/bundle/ruby/1.8/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
    from <path>/config.ru:4
    from <path>/vendor/bundle/ruby/1.8/gems/rack-1.3.1/lib/rack/builder.rb:51:in `instance_eval'
    from <path>/vendor/bundle/ruby/1.8/gems/rack-1.3.1/lib/rack/builder.rb:51:in `initialize'
    from <path>/config.ru:1:in `new'
    from <path>/config.ru:1
Guillermo Iguaran
Owner

Discussion can continue in #2230

rails-noob

See pull request #2577.

rails-noob

It seems my pull request fixes a different bug. Sorry!

Andrew White pixeltrix closed this
Andrew White
Owner

Fixed by this commit to Journey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.