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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:31:43+00:00 2026-05-26T06:31:43+00:00

I am practicing this RoR tutorial project of Michael Hartl: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book I am using

  • 0

I am practicing this RoR tutorial project of Michael Hartl: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

I am using Ruby 1.9.2 and Rails 3.1 on Ubuntu 11.04 with Apache and MySQL.

I am here now: http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#sec:destroying_users (where I have s list of users and a Delete link for each of them, me being the admin).

This is the delete link which supposed to work:

<%= link_to "delete", user, :method => :delete, :confirm => "You sure?",
                            :title => "Delete #{user.name}" %>

But when I mouseover I see this: “localhost/users/2” (for example)
And when I click on the Delete link it directs me to the user’s profile. I don’t get any confirmation window and no action is done (delete). It’s like a link to their profile and nothing else.
I am using Chrome but in Firefox is the same.

This is what I have:

1)the gem “jquery-rails” is installed

2)applications.js (from app/assets/javascripts) has these lines:

//= require jquery
//= require jquery_ujs
//= require_tree .

3)application.html.erb (from app/views/layouts) has these lines:

<%= javascript_include_tag :defaults %>
<%= csrf_meta_tags %>

In view source I see:

  <script src="/assets/defaults.js" type="text/javascript"></script>
  <meta content="authenticity_token" name="csrf-param" />
  <meta content="njPO91rB7p3EtTblD4jf4rkCVt+M76SKUt0rQhHc+qY=" name="csrf-token" />

4)in users_controllers.rb (from app/controllers) I have:

 before_filter :authenticate, :only => [:index, :edit, :update, :destroy]
 before_filter :correct_user, :only => [:edit, :update]
 before_filter :admin_user,   :only => :destroy

 def destroy
  User.find(params[:id]).destroy
  flash[:success] = "User destroyed."
  redirect_to users_path
 end

 private
  def admin_user
    redirect_to(root_path) unless current_user.admin?
  end

5)in routes.rb (from config) I have:

resources :users

What is wrong with that Delete link?
I’ve searched StackOverflow for answers but apparently I couldn’t find one to suit my situation.

On the same RoR project the follow/unfollow button using Ajax works just fine (can’t post a second link here for now because I just registered to the SO).

So, why the link doesn’t work? Is it a Javascript problem or some other problem which I am not seeing?

Thanks.

  • 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-26T06:31:43+00:00Added an answer on May 26, 2026 at 6:31 am

    try using

      <%= javascript_include_tag "application" %>
    

    instead of :defaults

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

Sidebar

Related Questions

I just started practicing TDD in my projects. I'm developing a project now using
I am learning ruby and practicing it by solving problems from Project Euler .
I'm practicing on Django and using some online tutorial to build a web blog.
I'm using rvm with rails at work and when I cd into our project
I'm preparing to Microsoft Certificate exam (70-515), reading Microsoft book for this exam, practicing
I have been practicing with the online tutorial on how to do this except
I'm practicing Jquery and I've written this simple Jquery statement: var someText = $(table
Firstly this is not a homework question. I am practicing my knowledge on java.
I am practicing recursion and I can't see why this method does not seem
Been practicing with those system calls, but I stucked into this code: #include <stdio.h>

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.