Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:23:26+00:00 2026-06-12T14:23:26+00:00

This is kind of difficult to communicate but I’ll try without pasting all my

  • 0

This is kind of difficult to communicate but I’ll try without pasting all my code. I have Members who have one Mailbox which has many Receipts. In the header layout I have a nav that calls

<%= link_to "Message Center", member_mailbox_path(current_user.member_id) %>

It works on most pages like trails/# , the resource pages for various models
But on other pages, seems like custom route pages, I get this error

No route matches {:action=>"show", :controller=>"mailbox", :member_id=>16}

Running rake routes shows this:

member_mailbox GET    /members/:member_id/mailbox/:id(.:format)      mailbox#show

Routes are confusing to me, here are my routes for this problem (show message isn’t tested yet) …

resources :members do
 resources :mailbox do
  resources :receipts do
    member do
      get :show_message
    end
  end
 end
end

The routes for the pages that are showing the error are similar to this one

match '/my_plays', :to => "trails#my_plays"
match '/my_creations', :to => "trails#my_creations"

So not sure if my routes are right. I wonder if resources :mailbox is correct since I don’t have a bunch of resources for that, it’s a has_one …. THX

—-EDIT— after changing route per advice:

member_mailbox POST   /members/:member_id/mailbox(.:format)                            mailboxes#create
new_member_mailbox GET    /members/:member_id/mailbox/new(.:format)                       mailboxes#new
edit_member_mailbox GET    /members/:member_id/mailbox/edit(.:format)                      mailboxes#edit
                    GET    /members/:member_id/mailbox(.:format)                           mailboxes#show
                    PUT    /members/:member_id/mailbox(.:format)                           mailboxes#update
                    DELETE /members/:member_id/mailbox(.:format)                           mailboxes#destroy
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:23:28+00:00Added an answer on June 12, 2026 at 2:23 pm

    You may want to define a mailbox as a singular resource in your routes. Otherwise, Rails will expect you to pass in both the user id and the mailbox id for member_mailbox_path to route to mailbox#show. I believe this is why you’re getting a routing error. Since each user has one mailbox, there’s no need to make this extra lookup part of the route. So instead of resources :mailbox, you can do resource :mailbox:

    resources :members do
      resource :mailbox do
        resources :receipts do
          member do
            get :show_message
          end
         end
      end
    end
    

    I believe this would generate the following routes:

                     member_mailbox POST   /members/:member_id/mailbox(.:format)                           mailboxes#create
                 new_member_mailbox GET    /members/:member_id/mailbox/new(.:format)                       mailboxes#new
                edit_member_mailbox GET    /members/:member_id/mailbox/edit(.:format)                      mailboxes#edit
                                    GET    /members/:member_id/mailbox(.:format)                           mailboxes#show
                                    PUT    /members/:member_id/mailbox(.:format)                           mailboxes#update
                                    DELETE /members/:member_id/mailbox(.:format)                           mailboxes#destroy
    

    Notice that the lack of path names next to GET, PUT, and DELETE doesn’t mean they don’t exist; they’re just repeats of the POST path, but each responds to different HTTP methods.

    To render mailboxes#show, you’ll need to add a MailboxesController with a show route, which might do a look up for the member:

    class MailboxesController < ApplicationController
    
      def show
        @member = Member.find(params[:member_id])
        # other mailbox code...
      end
    
    end 
    

    And you’ll also create a template at app/views/mailboxes/show.html.erb to render the mailbox show page.

    Also, I would recommend against deeply nesting your routes, as in third level :receipts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a kind of difficult one to explain but basically I have a
I'm sorry if this was already answered, but it's kind of difficult to search
This kind of code would normally work in PHP, but since the scope is
It's very difficult to find this kind of document online. I found one in
This is kind of difficult to describe. I have a table with two fields:
I have a piece of code where I capture all exceptions and throw one
I perform this kind of query in my Python code to conn = rdbms.connect(instance=_INSTANCE_NAME,
I have this kind of question. In my form, i got this as a
I know this kind of questions have been asked already many times before. The
This is kind of difficult to explain so ill link to a page that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.