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

  • Home
  • SEARCH
  • 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 7660815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:30:58+00:00 2026-05-31T13:30:58+00:00

When I click on the ‘delete’ link (to delete the project), I wish to

  • 0

When I click on the ‘delete’ link (to delete the project), I wish to show a new page for the user to confirm the deletion (‘are you sure’ page). But when I click on the link, error No route matches [GET] “/assets” appears, I don’t know why. Can anyone help me?

This is my projects/index.html.erb

  1   <% @projects.each do |p| %>
  2       <%= link_to p.name, project_path(p) %>
  3       <%= link_to "edit", edit_project_path(p) %> 
  4       <%= link_to "delete",{ :action => 'delete', :controller => 'projects', :id => p.id } %> 
  5   <% end %>

This is my controllers/projects_controller.rb

 38   def delete     
 39     @project = Project.find(params[:id])
 40     render 'delete'
 41   end
 42     
 43   def destroy
 44     project = Project.find(params[:id])
 45     project.destroy
 46     flash[:notice] = "Page succesfully removed"
 47     redirect_to(projects_path)
 48   end

This is my views/projects/delete.html.erb

  1 <%= form_for(:project, :url => {:action => 'destroy', :id => @project.id }) do |f| %> 
  2   <p>Are you sure you want to remove "<%= @project.name %>"</p>
  3   <%= submit_tag ("Yes, I am sure")
  4 <% end %>

EDIT:My Url looks like this >>> http://localhost:3000/assets?action=delete&controller=projects&id=1

EDIT2: the solution is going to routes.rb and adding this line

  match ':controller(/:action(/:id))(.:format)'

Now the delete page appears. However, when I click the delete button Rails returns an error >> Unknown action The action ‘6’ could not be found for ProjectsController

  • 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-31T13:30:59+00:00Added an answer on May 31, 2026 at 1:30 pm

    The problem is this line:

    <%= form_for(:project, :url => {:action => 'destroy', :id => @project.id }) do |f| %>
    

    You’re not telling it to use the HTTP method DELETE when making this

    <%= form_for(:project, :url => {:action => 'destroy', :id => @project.id }, :method => :delete) do |f| %>
    

    You could also write this much, much shorter like this:

    <%= form_for(@project, :method => :delete) do |f| %>
    

    Rails will know precisely what URL to build, so you don’t need to tell it what to do.


    Bonus

    You could also do this with the initial link_to:

    <%= link_to "delete", [:delete, project], :method => :delete %>
    

    The array as the second argument here will compile the route using the polymorphic route builder in Rails.

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

Sidebar

Related Questions

I click on a link from one page that does a redirect to another
I click on the next link. It shows me the URL like http://www.domainname.com/fj_messages/index/page:2 I
User click on a link button and it will direct them to a url
Click the strip'slashes' link to see the page I'm referring to As you can
Click on this link , you will be redirected to a shopping site. On
On click a image how can another page be previewed in the same page
I click on items in my listbox and then hit a submit button, but
I want to stop click on any links until the page is loaded. Can
click(new XPath(/HTML[1]/BODY[1]/DIV[1]/DIV[2]/DIV[1]/DIV[2]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/SPAN[1]/SPAN[2]/#text[1])); ..or var foo = document.evaluate(/HTML[1]/BODY[1]/DIV[1]/DIV[2]/DIV[1]/DIV[2]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/DIV[2]/DIV[1]/SPAN[1]/SPAN[2]/#text[1], document, null, XPathResult.ANY_TYPE,null); Result to: [Exception... The
Click Reply by Email of that page, http://losangeles.kijiji.com/rooms-roommates/el-monte/room-for-rent-el-monte-california-91732/?ad=785656

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.