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.

exception when trying to get resource url

#807

I have the following routes (simplified version):

ActionController::Routing::Routes.draw do |map|

map.resources :projects do |project|

project.resources :calendar_events, :path_prefix => '/calendar', :as => 'events'
project.resources :calendar_exceptions, :path_prefix => '/calendar', :as => 'exceptions'

project.calendar '/calendar/:action', :controller => 'Calendar'

end

map.resources :calendar_events, :path_prefix => '/calendar', :as => 'events' map.resources :calendar_exceptions, :path_prefix => '/calendar', :as => 'exceptions' map.calendar '/calendar/:action', :controller => 'Calendar'

# Install the default route as the lowest priority. map.connect ':controller/:action/:id.:format' map.connect ':controller/:action/:id' end

when I'm trying to get url using new_calendar_event_url() everything work fine, but when I try to get it using new_project_calendar_event(@project) I get the following exception: You have a nil object when you didn't expect it! The error occurred while evaluating nil.to_sym

Stack trace: vendor/rails/actionpack/lib/action_controller/routing/route.rb:145:in extra_keys' vendor/rails/actionpack/lib/action_controller/routing/route.rb:145:inmap' vendor/rails/actionpack/lib/action_controller/routing/route.rb:145:in extra_keys' generated code (D:/projects/wt/trunk/vendor/rails/actionpack/lib/action_controller/routing/route.rb:45):3:ingenerate' vendor/rails/actionpack/lib/action_controller/routing/route.rb:122:in generate' vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:337:ingenerate' vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:131:in rewrite_path' vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:110:inrewrite_url' vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:88:in rewrite' vendor/rails/actionpack/lib/action_controller/base.rb:621:inurl_for' vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:71:in send' vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:71:inurl_for' (eval):17:in new_project_calendar_exception_url' app/views/calendar/_legend.html.erb:50:in_run_erb_47app47views47calendar47_legend46html46erb' app/views/calendar/index.html.erb:18:in _run_erb_47app47views47calendar47index46html46erb' script\server:3

Btw, it works fine after removing :path_prefix => '/calendar' from line

project.resources :calendar_events, :path_prefix => '/calendar', :as => 'events'

but unfortunately this is not url I need.

Reported by ElectroNick · August 12th, 2008 @ 07:07 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. ElectroNick
    ElectroNick

    not a bug, but my fault... after specifying :path_prefix => '/projects/:project_id/calendar' everything worked fine.

    August 12th, 2008 @ 07:29 PM

  2. josh
    josh
    • State changed from new to wontfix

    November 22nd, 2008 @ 07:36 PM