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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:06:51+00:00 2026-06-05T15:06:51+00:00

After following the RoR getting started tutorial, I added another model as: $ rails

  • 0

After following the RoR getting started tutorial, I added another model as:

$ rails g model Category name:string wdate:date

I added the line resources :category to my routes.rb file, and copy+pasted the initial Posts controller, changing names from Post to Category and Posts to Categories.

I did similarly with the index, form, new, and edit views.

Now, localhost:3000/category gives me an empty list of categories, and /category/new gives me an input form. Upon submission, however, I get

Routing Error

No route matches [POST] "/categories"

Try running rake routes for more information on available routes

Running rake routes as suggested shows that I have:

POST   /category(.:format)          category#create

Why is the form submitting to the wrong address? The only area where I put in the term "categories" was for the variable name in the #index handler, so I don’t understand why the form target is /categories. Do I have to explicitly set the path as /category for creation?

  • 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-05T15:06:53+00:00Added an answer on June 5, 2026 at 3:06 pm

    Your resources :category line inside config/routes.rb should be resources :categories.

    When you’re doing resources, you should always use the pluralized name of the resource so that Rails will automatically singularize it for member routing helpers of that resource, such as edit_category_path(category).

    It will then use the plural form in routes for collections, like the form_for. Because the object is new, the form will issue a POST request to /categories with the form data.

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

Sidebar

Related Questions

Just started ROR Lynda Tutorial, Error while trying to execute the rails server in
After following this MVC 4 tutorial series I was trying some of the stuff
After following the steps outline in this Fluent NHibernate tutorial I am stuck on
I am getting the following error after running git svn rebase: 'update-index --refresh: command
I'm following the RoR 3 Rails Tutorials, but to upgrade to a newer version
After following this question , I added HttpServletRequest parameter to my method. But I
After 3-4 months when I returned to another project on RoR, with Mongoid. I
I am following Michael Hartl's RoR tutorial, and it is covering the basics of
After following the instructions here How To Implement URL rewriting with UrlRewriter.Net? I'm getting
my setup is ubuntu - gitolite - msysgit. After following this tutorial : https://sites.google.com/site/senawario/home/gitolite-tutorial

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.