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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:06+00:00 2026-05-26T13:34:06+00:00

I have a Wizard model that the client references w/o an ID (it’s saved

  • 0

I have a Wizard model that the client references w/o an ID (it’s saved in the session), so I’ve created a singular resource for :show and :update. I want the admin to have access to all instances of that model via index so admin can delete strays, so I’ve added a plural resources for :index and :destroy. The index and destroy works, but I can’t figure out the right arguments to pass to form_for in the update view.

The setup

# config/routes.rb
WTest::Application.routes.draw.do
  resource :wizard, :only => [:show, :update]
  resources :wizards, :only => [:index, :destroy]
  ...
end

resulting in

$ rake routes
wizards GET    /wizards(.:format)     {:action=>"index", :controller=>"wizards"}
 wizard DELETE /wizards/:id(.:format) {:action=>"destroy", :controller=>"wizards"}
        GET    /wizard(.:format)      {:action=>"show", :controller=>"wizards"}
        PUT    /wizard(.:format)      {:action=>"update", :controller=>"wizards"}

This sets up routes the way I’d expect.

The question (revised since original post)

In the console:

>> app.wizard_path

raises the error ActionController::RoutingError: No route matches {:action=>"destroy", :controller=>"wizards"}

Why is this? Have I set up my routes incorrectly? I need to specify :url => wizard_path for form_for() in the wizards’s update view.

The details

If I specify an explicit path in my call to form_for:

# app/view/wizards/update.html.erb
<%= form_for @wizard, :url => wizard_path do |f| %>
  <%= f.submit %>
<% end %>

… then attempting to render this for gets an error on the form_for line:

No route matches {:action=>"destroy", :controller=>"wizards"}

I have no idea why it’s trying to match the destroy action. How do I get the form to submit to the {action=>"update", :controller=>"wizards"} route?

(By the way, I looked at bug 267, and I don’t think it is the same as what I’m observing. But if it is this bug, is there a workaround?)

  • 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-26T13:34:06+00:00Added an answer on May 26, 2026 at 1:34 pm

    Carrying on the long tradition of answering my own questions (meh!), I think I figured it out. If my analysis is wrong, I’d be happy to give someone else the checkmark…

    The cause of the problem

    Look at the output of rake routes

    $ rake routes
    wizards GET    /wizards(.:format)     {:action=>"index", :controller=>"wizards"}
     wizard DELETE /wizards/:id(.:format) {:action=>"destroy", :controller=>"wizards"}
            GET    /wizard(.:format)      {:action=>"show", :controller=>"wizards"}
            PUT    /wizard(.:format)      {:action=>"update", :controller=>"wizards"}
    

    The path method ‘wizard_path’ is ambiguous: it can either refer to the DELETE clause, in which case it needs an :id argument (wizard_path(22)), or it can refer to the GET and PUT clauses, in which case it doesn’t take an ID argument.

    The solution

    So my solution was to create a route specifically for deletion. My revised routes.rb file now reads:

    resources :wizards, :only => [:index]
    resource :wizard, :only => [:show, :update]
    match 'wizard/:id' => 'wizards#destroy', :via => :delete, :as => :delete_wizard
    

    and rake routes now produces:

    $ rake routes
          wizards GET    /wizards(.:format)    {:action=>"index", :controller=>"wizards"}
           wizard GET    /wizard(.:format)     {:action=>"show", :controller=>"wizards"}
                  PUT    /wizard(.:format)     {:action=>"update", :controller=>"wizards"}
    delete_wizard DELETE /wizard/:id(.:format) {:controller=>"wizards", :action=>"destroy"}
    

    I needed to make a one-line change to the delete link in wizards/index.html.erb to use the new delete_wizard_path, but everything works now.

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

Sidebar

Related Questions

I have this installation file setup.exe that was created with installShield wizard. as part
I want to build a shop in which the products have a little wizard
I have an app that I'm writing a little wizard for. It automated a
I have created an Item Template using the Export Template wizard. I opened up
I have used Visual Studio 2008 ASP.NET AccessDataSource Wizard to generate the update command.
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
I have a EDM that was wizard generated from an SQL 2005 Express database.
I am developing a wizard using Formwizard that matches one model. Also due to
I have an Entity Framework model that was generated by the Visual Studio 2008
i have a NavigationWindow that implements a wizard functionality, and a set of Page

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.