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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:31:00+00:00 2026-05-24T09:31:00+00:00

I have this code in my routes: controller :active_car do put ‘switch_car’ => :update

  • 0

I have this code in my routes:

   controller :active_car do
    put 'switch_car' => :update
    get 'switch_car' => :edit
   end

This is my code in on my edit page.

    <% form_tag('switch_car', :method => :put) do%>
<div class="field">
    <label for="car_info_id">Car Name:</label>
    <%= select("", "car_info_id", @available_cars.collect {|v| [v.name, v.id]})%>
</div>
<div>
    <%= submit_tag "Switch Car" %>
</div>
<% end %>

When I click submit I get the following routing error.

No route matches “/switch_car” with the url pointing to http://localhost:3000/switch_car?method=put

The get is working just fine as I end the url with switch_car I get my page to edit. For some reason the put definition is not working.

After changing method to second argument it just doesn’t work. It seems to have post as the method still instead of put. Here is generated HTML

<form accept-charset="UTF-8" action="switch_car" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" />
  • 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-24T09:31:01+00:00Added an answer on May 24, 2026 at 9:31 am

    :method belongs to the “options” hash, which is form_tag’s second argument, not the first.

    http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-form_tag

    Please inspect the html generated by that tag and post it here.

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

Sidebar

Related Questions

I have this in my Global.asax.cs: routes.MapRoute( User, User/{username}/{action}, new { controller = User,
I have this code in Global.asax.cs: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute({resource}.axd/{*pathInfo}); routes.MapRoute(
This code is inside the master page: <li><a href=<%=Url.Action(Action, Controller) %>>Main site link</a></li> <li><a
Lets say we have this route: routes.MapRoute( Library, Lib/{id}/{lang}, New With {.controller = MyLibrary,
I have this code in jQuery, that I want to reimplement with the prototype
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have this code that performs an ajax call and loads the results into
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
I have this code: CCalcArchive::CCalcArchive() : m_calcMap() { } m_calcMap is defined as this:
I have this code: myVariable which I want to change into trace(myVariable: + myVariable);

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.