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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:36:55+00:00 2026-05-17T19:36:55+00:00

I’m diving into Ruby on Rails and I’m experiencing a weird bug, using Rails

  • 0

I’m diving into Ruby on Rails and I’m experiencing a weird bug, using Rails 3.0.1 and Ruby 1.8.7. Using the generated scaffold code, my “Show” action is getting called when I’m expecting my “Destroy” action to get called. Here’s the code…

routes.rb

webappdotcom::Application.routes.draw do
  resources :projects
  root :to => "home#index"
end

index.html.erb

<td><%= link_to 'Destroy', project, :confirm => 'Are you sure?', :method => :delete %></td>

actual HTML code that is rendered in browser

<td><a href="/projects/12" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a></td>

server output when I click on the “Destroy” link

Started GET "/projects/12" for 127.0.0.1 at Wed Oct 20 23:39:37 -0500 2010
  Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"12"}
  Project Load (0.1ms)  SELECT "projects".* FROM "projects" WHERE ("projects"."id" = 12) LIMIT 1
Rendered projects/show.html.erb within layouts/application (9.0ms)
Completed 200 OK in 77ms (Views: 13.3ms | ActiveRecord: 0.1ms)

You can see the “ProjectsController#show” action is being called, but I want the “Destroy” action to be called. Also, I noticed the browser isn’t displaying the confirmation message “Are you sure?” either. Any ideas what could be causing this or what I’m missing?

Thanks so much!

  • 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-17T19:36:56+00:00Added an answer on May 17, 2026 at 7:36 pm

    This is because Rails 3 changed the way it uses javascript in forms. It used to add an onclick method to the link, but that goes against unobtrusive javascript. Now it just sets some tag attributes, and hooks into it with javascript in another file.

    That page’s layout (which is probably application.html.erb unless you’ve changed it) needs to have this line in the head section:

    <%= javascript_include_tag :defaults %>
    

    If this line is missing from your layout, that’s the problem. Another possible cause could be if you’ve added the jQuery library to your app without adding the rails-specific jQuery library. Let me know how this works.

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

Sidebar

Related Questions

No related questions found

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.