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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:32:00+00:00 2026-05-23T14:32:00+00:00

Every time i delete or destroy a Product it aways give me this error

  • 0

Every time i delete or destroy a Product it aways give me this error in my console:

ActiveRecord::RecordNotFound (Couldn't find Product with ID=4):
  app/controllers/products_controller.rb:16:in `show'

and on the page it gives:

ActiveRecord::RecordNotFound in ProductsController#show

Couldn't find Product with ID=4

In my Products Controller i just have the regular scaffold:

def show
    @product = Product.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @product }
    end
  end

def destroy
    @product = current_user.products.find(params[:id]) #current user deletes own
    @product.destroy

    respond_to do |format|
      format.html { redirect_to(products_url) }
      format.xml  { head :ok }
    end
  end

I am using Rails Jquery UJS and rails-jquery and have the csrf_meta_tagin my app layout. What i have noticed is when i click the destroy link and it pops up the window and says “Are you Sure”, i click the OK button and it flickers TWICE for some strange reason, it never did this until i installed Jquery. How do i fix this?

EDIT – ANSWER:

Reinstall rails jquery-ujs > https://github.com/rails/jquery-ujs

You have to keep both files jquery.min.js and jquery.js. I deleted the jquery.min.js because i thought it was a minimized version but apparently not, here are all of my files from jquery-ujs:

   jquery.js
   jquery.min.js
   jquery_ujs.js
   rails.js # i had to install this manually from the link (or zip file)
   jquery-ui # i wanted the user interface too
  • 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-23T14:32:00+00:00Added an answer on May 23, 2026 at 2:32 pm

    Make sure you have the rails.js file in javascripts? When you move from prototype to jquery, the standard restful DELETE doesn’t work properly anymore. rails.js fixes that so it works normally again. You can refer to Josh Huckabee’s article here: http://joshhuckabee.com/jquery-rails-3. Hopefully that helps.

    PS: Also make sure you include rails.js in your layout. Something like this:

    <%= javascript_include_tag 'jquery-1.4.4.min', 'jquery-ui-1.8.7.custom.min', 'rails', 'application' %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I guess there must be an auto reindex every time a delete takes place.
Every time I call this method my NSMutableData is leaking and I cannot figure
I've created a custom sync adapter, but every time I delete a contact using
Every time I click the Delete Button, the check marks double in quantity: Public
In my app I create temp dirs every time user commits a certain action.
Every time this code is reopened the insertion cursor moves one line lower, how
Every time I turn on my company-owned development machine, I have to kill 10+
Every time I create a new project I copy the last project's ant file
Every time I create an object that has a collection property I go back
Every time I need to work with date and/or timstamps in Java I always

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.