In my application I have users, and then each user has one mailbox where they're delivered messages. My routes.rb looks something like:
resources :users do
resources :mailboxes
end
If I do a rake route, I see this route available to me:
user_mailbox GET /users/:user_id/mailboxes/:id(.:format) {:action=>"show", :controller=>"mailboxes"}
I wanted to link to this path in my application layout, in a sort of toolbar the user finds at the top of the screen.
My view code is:
<%= link_to image_tag("mail_icon.png", :id => 'mail_notice'), user_mailbox_path(current_user)%>
The problem I'm having is that I get a routing error for this path if I'm nothing withing users/* - So anywhere else in my application besides the resource my mailbox is nested under. If I'm on, lets say my user's index page, the path does work without issue.
No route matches {:action=>"show", :controller=>"mailboxes",
Is there something I could be missing with this route? Anything related to users works, it's just the mailbox that I'm having issues with.
Thanks