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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:46:30+00:00 2026-05-20T15:46:30+00:00

I am having a problem. I can’t delete kategoris. Rake routes: admin_kategoris GET /admin/kategoris(.:format)

  • 0

I am having a problem. I can’t delete kategoris.

Rake routes:

       admin_kategoris GET    /admin/kategoris(.:format)               {:action=
>"index", :controller=>"admin/kategoris"}
                        POST   /admin/kategoris(.:format)              {:action=
>"create", :controller=>"admin/kategoris"}
     new_admin_kategori GET    /admin/kategoris/new(.:format)          {:action=
>"new", :controller=>"admin/kategoris"}
    edit_admin_kategori GET    /admin/kategoris/:id/edit(.:format)     {:action=
>"edit", :controller=>"admin/kategoris"}
         admin_kategori GET    /admin/kategoris/:id(.:format)          {:action=
>"show", :controller=>"admin/kategoris"}
                        PUT    /admin/kategoris/:id(.:format)          {:action=
>"update", :controller=>"admin/kategoris"}
                        DELETE /admin/kategoris/:id(.:format)          {:action=
>"destroy", :controller=>"admin/kategoris"}

My kategori index view:

<% @kategoris.each do |kategori| %>
  <tr>
    <td><%= kategori.name %></td>
    <td><%= link_to 'show', {:action => 'show', :id => kategori.id}, :class => 'action show' %></td>
    <td><%= link_to 'edit', {:action => 'edit', :id => kategori.id}, :class => 'action edit' %></td>
    <td><td><%= link_to 'slet', {:action => 'destroy', :id => kategori.id, :method => :delete}, :class => 'action destroy' %></td></td>
  </tr>
<% end %>

My kategori controller:

 def destroy
    @kategori = Kategori.find(params[:id])
    @kategori.destroy

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

My routes.rb:

namespace :admin do
resources :kategoris
end

I get following error when I press slet (Delete):

Started GET "/admin/kategoris/1?method=destroy" for 127.0.0.1 at 2011-03-05 20:0
8:57 +0100
  Processing by Admin::KategorisController#show as HTML
  Parameters: {"method"=>"destroy", "id"=>"1"}
  ←[1m←[36mKategori Load (1.0ms)←[0m  ←[1mSELECT `kategoris`.* FROM `kategoris`
WHERE (`kategoris`.`cached_slug` = '1') LIMIT 1←[0m
  ←[1m←[35mSQL (1.0ms)←[0m  SELECT sluggable_id FROM slugs WHERE ((slugs.sluggab
le_type = 'Kategori' AND slugs.name = '1' AND slugs.sequence = 1))
  ←[1m←[36mKategori Load (0.0ms)←[0m  ←[1mSELECT `kategoris`.* FROM `kategoris`
WHERE (`kategoris`.`id` = 1) LIMIT 1←[0m
Rendered admin/kategoris/show.html.erb within layouts/application (5.0ms)
Completed   in 166ms

ActionView::Template::Error (No route matches {:action=>"edit", :controller=>"ka
tegoris", :id=>#<Kategori id: 1, name: "Elektronik", created_at: "2011-02-17 04:
18:11", updated_at: "2011-02-17 04:18:11", cached_slug: "">}):
    6: </p>
    7:
    8:
    9: <%= link_to 'Edit', edit_kategori_path(@kategori) %> |
    10: <%= link_to 'Back', admin_kategoris_path %>
  app/views/admin/kategoris/show.html.erb:9:in `_app_views_admin_kategoris_show_
html_erb__679400070_47327076__118033797'
  app/controllers/admin/kategoris_controller.rb:18:in `show'

Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_request_and_response.erb (4.0ms)
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/template_error.erb within rescues/layout (57.0ms)

My edit link works.

  • 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-20T15:46:30+00:00Added an answer on May 20, 2026 at 3:46 pm

    When using Rails’ RESTful actions, the destroy method is invoked by a DELETE request (as indicated by the “DELETE” at the beginning of your rake routes output), not by a GET request (which is the default unless you specify otherwise). So, you need to specify this in your link:

    <td><%= link_to 'slet', {:action => 'destroy', :id => kategori.id}, :method => :delete, :class => 'action destroy' %></td>
    

    This could be simplified to:

    <td><%= link_to 'slet', admin_kategori_path(kategori), :method => :delete, :class => 'action destroy' %></td>
    

    since admin_kategori is a named route that leads to the correct URL, and using the DELETE method will automatically call the destroy action (since that’s what the routes say to do).

    [Update]

    It’s also possible that you don’t have your UJS set up properly. You need to:

    1. make sure the rails.js script tag (and any libraries it may depend on, like Prototype or jQuery depending on your setup) is included in your layout, and
    2. make sure you’re outputting csrf_meta_tag in the head of your layout. If you’re not, it will not work
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problem with double linked lists: I can't get data from nodes throgh
I'm having a problem with my Seam code and I can't seem to figure
Here's the problem I'm having, I've got a set of logs that can grow
Im having a problem with a final part of my assignment. We get in
I'm new to url rewriting and having a problem i can't figure out. I
HI Guys, Here I am having problem that How can I post an image
I'm having problem with asynctasks and http requests. The user can press two different
I'm having problem with Zend_Search_Lucene. I have few documents with field tags in index.
So I'm having a problem and I can't think of a fix for it.
I am having problem updating my mysql in my web application.. I can't Update

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.