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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:12:18+00:00 2026-05-16T12:12:18+00:00

I have a ruby-on-rails application and I’m now wondering why RoR uses Restful Requests:

  • 0

I have a ruby-on-rails application and I’m now wondering why RoR uses Restful Requests:
eg. if you want delete an ressource it’s a best practice to do it with such an HTTP Request:

DELETE /entry/13

you can also do it with with such an normal request:
GET /entry/delete/13 or GET /entry/13/delete

now my question:
when i make a link to such an restful delete operation with the link_to helper

link_to :controller =>:delete, :id => id, :method => :delete

it results in some cryptic javascript:

<a href="/entry/13" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'GIep/wk5+6EMX23qY4TAP7joKy/G3f5uvMI6d6n9vlA='); f.appendChild(s);f.submit();return false;">Delete</a>

So whats the idea behind it?
In my opinion you just exclude non-javascript users.

  • 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-16T12:12:19+00:00Added an answer on May 16, 2026 at 12:12 pm

    All versions of Rails < 3 use very obtrusive javascript (and the result is pretty ugly, as you’ve demonstrated).

    The doc suggests the method will fall-back to using GET if javascript is disabled:

    :method => symbol of HTTP verb – This
    modifier will dynamically create an
    HTML form and immediately submit the
    form for processing using the HTTP
    verb specified. Useful for having
    links perform a POST operation in
    dangerous actions like deleting a
    record (which search bots can follow
    while spidering your site). Supported
    verbs are :post, :delete and :put.
    Note that if the user has JavaScript
    disabled, the request will fall back
    to using GET. If you are relying on
    the POST behavior, you should check
    for it in your controller‘s action by
    using the request object‘s methods for
    post?, delete? or put?.

    Either way, I would suggest you create the “destroy” links like so:

    # when you have an "entry" object
    link_to "Destroy", entry, :method => :delete
    
    # when you only have an "entry" object's id
    link_to "Destroy", entry_path(:id => id), :method => :delete
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using ActiveResource in my Ruby on Rails applications for some time,
Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications -
I have a Ruby on Rails Website that makes HTTP calls to an external
Ruby on Rails controllers will automatically convert parameters to an array if they have
I have a Ruby script in my Rails app that I use to load
I have a polymorphic association in a Ruby on Rails model. In the migration,
I have been creating a website with Ruby on Rails, and will be hosting
In my Ruby on Rails app, I have a User table and a Foo
I am new to Ruby on Rails, I have completed the Blog Tutorial .
I am using ruby on rails with a MySQL backend. I have a table

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.