# ActionController::RoutingError in Posts#index

**URL:** <https://www.ruby-forum.com/t/actioncontroller-routingerror-in-posts-index/190099>\
**Category:** Rails\
**Created:** [June 15, 2010, 1:56am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-in-posts-index/190099 "2010-06-15T01:56:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quangn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/e47774/32.png) [@quangn](https://www.ruby-forum.com/u/quangn)\
**Post date:** [June 15, 2010, 1:56am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-in-posts-index/190099/1 "2010-06-15T01:56:53Z")

</div>

Not sure what happened to my last post so I will try again, here goes…

I am getting the following error and not sure why? I think its because  
I am sending over an id when I shouldn’t be. I was logged into my app  
when I created this code referenced below and all was fine. I then  
logged out and now I am getting this error everywhere and can’t even get  
into the log-in screen without commenting the code out. Any  
suggestions?

Showing app/views/pages/\_stats.html.erb where line #4 raised:

subscribing\_user\_url failed to generate from {:controller=\>“users”,  
:action=\>“subscribing”, :id=\>false}, expected: {:controller=\>“users”,  
:action=\>“subscribing”}, diff: {:id=\>false}

Extracted source (around line #4):

1: \<% @user ||= current\_user %\>  
2:

  
3: 
# 4: 5: 6: \<%= @user.subscribing.count %\> subscribing 7:

---

<div class="post-metadata">

**Author:** ![quangn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/e47774/32.png) [@quangn](https://www.ruby-forum.com/u/quangn)\
**Post date:** [June 15, 2010, 2:22am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-in-posts-index/190099/2 "2010-06-15T02:22:32Z")

</div>

Ok, think I figured it out. @user and current\_user are both nil and so  
thus the error. So put in the following and seems to work.

\<% @user ||= current\_user %\>  
\<% if @user %\>  
…  
\<% end %\>
