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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:21:21+00:00 2026-06-09T05:21:21+00:00

I have seen this question answered here, but unfortunately the answer does not work.

  • 0

I have seen this question answered here, but unfortunately the answer does not work. FYI this is a Rails 2.3.11 application.

I want to call create with this link_to helper against a RESTful resource:

link_to("Add", part_types_path(myid), :method => :post)

Now very, very strangely, the id that I’m passing in to the URL helper is being interpreted as “format” by the Rails application! So the link comes out to be:

/part_types.12345

where “12345” is the id. Crazy!

I am missing something very basic for sure, but I have NEVER seen Rails try to call an object id a format.

Here is the routes entry:

map.resources :part_types, :collection => { :part_list => :get }

and here is the result from “rake routes”

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

Notice the absence of any sort of id!

  • 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-09T05:21:22+00:00Added an answer on June 9, 2026 at 5:21 am

    The route with the name part_types refers to the index action if the method is GET and to the create action if the method is POST. Neither of those actions have parameterized paths (in contrast to show which should look like /part_types/:id). create is supposed to create a new record and return its id – you usually don’t pass them in the request as unique id generation is easier on the server.

    Your first argument will be interpreted as the format because the route does not take any parameters. Compare this to the following:

    • part_type_path(1) should return /part_types/1
    • part_type_path(1, :json) should return /part/types/1.json.

    Check actionpack/lib/action_dispatch/routing/mapper.rb to see how resources is defined.

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

Sidebar

Related Questions

I've seen this question answered here for Rails 2, but not Rails 3. I
I have seen many answers for this type of question but its not related
I think I have seen this question before but I don't think it's answered
I have seen this question answered in reference to Bash, but can't find one
I have seen this question asked previously but can not find a clear explanation
I've seen this question asked here but I haven't found one that is answered
In Microsoft SQL Server: I have seen this question several times, but can't see
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
This question seems to have been asked a lot, but I haven't seen an
I have seen this question/answer: How do you draw text on a <canvas> tag

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.