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 6092307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:25:38+00:00 2026-05-23T12:25:38+00:00

I am using Ruby on Rails 3.0.7 and I am trying to set correctly

  • 0

I am using Ruby on Rails 3.0.7 and I am trying to set correctly (and as well as possible) my router.

In the routes.rb file I have:

namespace :articles do 
  resources :categories 
end

resources :articles

In order to work as expected, I must state the namespace before the resources :articles statement so that the router intercepts requests and direct these to the namespace related to articles. Otherwise (if the resources :articles is stated before of the namespace), as it is possible deduct from the above code, all requests like

<my_site>/articles/1
<my_site>/articles/new
<my_site>/articles/1/edit
...

are intercepted so that the articles namespace will be “hardly” reached. For example, if you make a request like <my_site>/articles/categories it will generate an error as the following:

ActiveRecord::RecordNotFound
Couldn't find Article with ID=categories

So, how can I handle this situation and how can I improve the router code? What do you advice about?


Running the command rake routes in my console I get this (as it is ordered):

articles_categories GET   /articles/categories(.:format)                                                        
{:action=>"index", :controller=>"articles/categories"}

POST   /articles/categories(.:format)
{:action=>"create", :controller=>"articles/categories"}

new_articles_category GET    /articles/categories/new(.:format)                                                   
{:action=>"new", :controller=>"articles/categories"}

edit_articles_category GET    /articles/categories/:id/edit(.:format)                                              
{:action=>"edit", :controller=>"articles/categories"}

articles_category GET    /articles/categories/:id(.:format)                                                   
{:action=>"show", :controller=>"articles/categories"}

PUT    /articles/categories/:id(.:format)                                                    
{:action=>"update", :controller=>"articles/categories"}

DELETE /articles/categories/:id(.:format)                                                   
{:action=>"destroy", :controller=>"articles/categories"}

articles GET    /articles(.:format)                                                                   
{:action=>"index", :controller=>"articles"}

POST   /articles(.:format)                                                                  
{:action=>"create", :controller=>"articles"}

new_article GET    /articles/new(.:format)                                                              
{:action=>"new", :controller=>"articles"}

edit_article GET    /articles/:id/edit(.:format)                                                         
{:action=>"edit", :controller=>"articles"}

article GET    /articles/:id(.:format)                                                               
{:action=>"show", :controller=>"articles"}

PUT    /articles/:id(.:format)                                                               
{:action=>"update", :controller=>"articles"}

DELETE /articles/:id(.:format)                                                               
{:action=>"destroy", :controller=>"articles"}
  • 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-05-23T12:25:39+00:00Added an answer on May 23, 2026 at 12:25 pm

    Check this rails documentation about controller namespaces. It says you need to namespace your categories controller like Articles::CategoriesController and you need to place your categories controller under app/controllers/articles directory.

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

Sidebar

Related Questions

I am trying to set up Ruby on Rails on windows. I am using
I am using Ruby on Rails 3 and I am trying to set values
I am using Ruby on Rails 3 and I am trying to set an
I'm using Ruby on Rails 3.1 with mongoid and trying to set up som
I am using Ruby on Rails 3.0.9 and I am trying to set dynamically
I'm trying to write an app using Ruby on Rails and I'm trying to
I'm trying to build a web service using Ruby on Rails. Users authenticate themselves
I am using ruby on rails with a MySQL backend. I have a table
I'm a new ruby/rails user trying to get my mac set up for the
I'm trying to load up rails in the test environment using a ruby script.

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.