Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Cannot include ActionView::Helpers and Rails.application.routes.url_helpers at the same time

#6652

When using the Rails console you cannot include Rails.application.routes.url_helpers and ActionView::Helpers (especially FormHelper/FormTagHelper/UrlHelper) at the same time: the named routes won't work anymore:

>> some_route_url
NoMethodError: undefined method `host_with_port' for nil:NilClass
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/activesupport-3.0.5/lib/active_support/whiny_nil.rb:48:in `method_missing'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.5/lib/action_controller/metal/url_for.rb:9:in `url_options'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.5/lib/action_view/helpers/url_helper.rb:32:in `url_options'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.5/lib/action_dispatch/routing/url_for.rb:131:in `url_for'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.5/lib/action_view/helpers/url_helper.rb:99:in `url_for'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:195:in `projects_url'
    from (irb):5
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in `start'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in `start'
    from /home/ben/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.5/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Reported by Jan Lelis · March 30th, 2011 @ 12:08 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Jan Lelis
    Jan Lelis
    • Tag changed from actionpack actionview helpers to actionpack, actionview, helpers, routes

    March 30th, 2011 @ 12:09 PM