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

The Archive Base Latest Questions

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

I have a blog style site and under each article there is the usual

  • 0

I have a blog style site and under each article there is the usual ‘view’ ‘edit’ and ‘delete’ functions for users once they are signed in. The issue is when I click on ‘delete’ the link it sends you to the ‘view’ article page and doesn’t delete the article. Can’t figure this one out as the delete and view paths are different in my code but do the same thing…??

class ArticlesController < ApplicationController

  before_filter :authenticate_user!, :except => [:index, :show]

# GET /articles
# GET /articles.xml
# display the amount of article on the home page

def index
@articles = Article.published.page(params[:page]).per(6).ordered

respond_to do |format|
  format.html # index.html.erb
 # format.atom #index.atom.builder
  format.xml  { render :xml => @articles }
end
end


 # GET /articles/1
 # GET /articles/1.xml
def show
  @article = Article.find(params[:id])
  @comment = Comment.new(:article=>@article)

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

...

/controllers/articles_controller

# DELETE /articles/1.xml
 def destroy
@article = Article.find(params[:id])
 authorize! :destroy, @article
@article.destroy

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

views/articles/_article.html.erb

<div class= "art-links">
<%= link_to 'Read', article %>
  <% if can? :update, article %>
 | <%= link_to 'Edit', edit_article_path(article) %> |      
 <% end %>

 <% if can? :destroy, article %>
  <%= link_to 'Delete', article, :confirm => 'Are you sure?', :method => :delete %>
<% end %>
  </div>
<br />

  • 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-22T13:07:35+00:00Added an answer on May 22, 2026 at 1:07 pm

    This may be because you don’t have the right javascript files set up. Rails 3 uses unobtrusive javascript to create the DELETE request when you click the link. If the javascript isn’t working, it will fall back to doing a GET which will render the show action.

    Make sure you have rails.js and prototype.js in your layout. If you are using a javascript framework other than Prototype, you will need to have that framework (jQuery or whatever) along with the appropriate port of rails.js.

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

Sidebar

Related Questions

I have a blog-style app that allows users to tag each post with topics.
I have a landing page on rails with blog style posts. Since it's the
I have a blog (designed with blogger) and there's one problem. If I access
I have a site.master in my root, and a site.master in my /blog/ directory.
I have a website that allows a user to create blog posts. There are
I've a simple blog style system where a user can have many entries. I've
i have the following CSS style sheet in Site.css .img { width: 1300px; height:
In a Windows 8 style app I have a View (or page) which is
I have done split view using 'hbox' layout, as below: Ext.define('Sencha.view.Blog', { extend: 'Ext.Panel',
I'm designing a web site where I've got a blog post and have the

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.