Named route error: "failed to generate"


#1

I don’t know much about named routes so I’m looking for a clue here.
If this isn’t enough info to properly diagnose this, please tell me!
The error is:

wap_event_disc_url failed to generate from
{:invitation_id=>nil, :controller=>“wap”, :all_comments=>true,
:action=>“event_details”, :token=>“wb”, :id=>“603”},
expected: {:controller=>“wap”, :action=>“event_details”}, diff:
{:invitation_id=>nil, :all_comments=>true, :token=>“wb”, :id=>“603”}

Extracted source (around line #9):

6: <% end %>
7: <%= render :partial => “comment”, :collection => @comments %>
8: <% if @comments.size == 1 && subject.discussion_posts.count > 1 %>
9: <%= link_to “Show all #{subject.discussion_posts.count} comments”,
all_comments_url(subject) %>
10: <% end %>
11: <% if subject.is_a?(Place) || (subject.is_a?(Event) &&
(subject.owned_by_user || @invitation)) %>
12: <% if @comments.empty? %>

Here’s the named route:

wap.wap_event_disc ‘ev/:id/:token/:invitation_id/
all_comments’, :action => ‘event_details’, :invitation_id =>
nil, :token => nil

One thing that does seem weird to me is that “all_comments_url”
mentioned in the line as the error is NOT based on a named route. It’s
a method in the application_helper:

def all_comments_url(subject)
if subject.is_a?(Place)
wap_listing_url(:id => subject, :all_comments => true, :anchor
=> ‘message_board’)
elsif subject.is_a?(Event)
wap_event_disc_url(:id => subject, :all_comments =>
true, :token => subject.wap_token, :invitation_id =>
params[:invitation_id], :anchor => ‘message_board’)
else
‘’ # 2 single quotes
end
end

(Does it clobber something in routes to name a method with _url at the
end?)

Any ideas about how to handle this would be greatly appreciated.
Thanks!

-Jason