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

  • Home
  • SEARCH
  • 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 8044633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:17:25+00:00 2026-06-05T05:17:25+00:00

I am trying to get a basic nested resource path to work but am

  • 0

I am trying to get a basic nested resource path to work but am currently getting the following error:

No route matches {:action=>"show", :controller=>"stores"}

In my view I have the following links:

 <% if current_user %> Hello <%= current_user.email %> /
  <%= link_to 'Store', user_store_path %> 
    <%= link_to 'New Store', new_user_store_path %>
    <%= link_to 'My Profile', home_path %>
    <%= link_to 'Edit Profile', update_path %>
    <%= link_to "Logout", logout_path %> 
   <% else %>
   <%= link_to "Login", login_path %> / <%= link_to "Sign up", signup_path %>
  <% end %>

Now when I rake my routes the paths I am being given match exactly those above – user_store_path etc..

My routes file looks like this:

   resources :users do
     resources :stores
   end

   match "signup" => "users#new"
   match "home" => "users#show"
   match "update" => "users#edit"

   get "login" => "sessions#new"
   post "login" => "sessions#create"
   delete "logout" => "sessions#destroy"
   get "logout" => "sessions#destroy"

   resources :sessions

   root :to => 'sessions#new'

This really is confusing me a lot because everything I have read on the RoR website suggests that this should work. Does anyone have any ideas where I am going wrong?

  • 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-05T05:17:26+00:00Added an answer on June 5, 2026 at 5:17 am
    resources :users do
      resources :stores
    end
    

    creates store routes which all require a given user since it is nested.

    So e.g. <%= link_to 'Store', user_store_path %> is wrong because it doesn’t provide any user. It should be <%= link_to 'Store', user_store_path(current_user, store) %>.

    This also applies to your other links, e.g. <%= link_to 'New Store', new_user_store_path %> which should be <%= link_to 'New Store', new_user_store_path(current_user) %>

    update based on your comment

    No route matches {:action=>"show", :controller=>"stores" [...] occurs because you want to show a particular resource, in this example a store. Therefore, you need to pass in the store id or the store object to generate the path/url. E.g. <%= link_to 'Store', user_store_path(current_user, current_user.store.first %>. I missed that on my initial answer, sorry.

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

Sidebar

Related Questions

I am trying to get a basic form to work and am struggling because
I'm trying to get a basic sample across domains working, but I just cannot
I have been trying to get a basic reorderlist working following this guide ->
So I'm trying to get some basic jQuery code with Rails working, but it
Im trying to get into some basic JavaFX game development and I'm getting confused
I've been trying to get this basic function to work for the last 2
I'm trying to get a basic Spring Integration configuration running with JMS. The problem
I'm trying to get a basic flip animation transition working when I push a
I'm trying to get a basic datagrid for simple tabular input. The server will
I am trying to get a basic understanding on how to use fputc in

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.