# Named route error: "failed to generate"

**URL:** <https://www.ruby-forum.com/t/named-route-error-failed-to-generate/105119>\
**Category:** Rails\
**Created:** [May 25, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/named-route-error-failed-to-generate/105119 "2007-05-25T22:22:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [May 25, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/named-route-error-failed-to-generate/105119/1 "2007-05-25T22:22:45Z")

</div>

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
