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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:55:19+00:00 2026-06-08T16:55:19+00:00

So, I’m learning Ruby on Rails. I get the fundamentals of the RESTful approach

  • 0

So, I’m learning Ruby on Rails. I get the fundamentals of the RESTful approach to application architecture, but I haven’t yet built a RESTful application completely.

In a traditional web application, idempotent requests (which don’t change any state) are made via HTTP’s GET method and all non-idempotent requests are typically made via the POST method. For the application to distinguish between the different actions a POST request might be triggering, there’s usually a hidden field in the form that gets included with the POST request, like action=delete or action=add_to_foo_file. This is a fairly simple architecture and is pretty common today, but the REST approach steers us away from this and suggests that this “let’s POST everything!” design is considered harmful.

Instead, a RESTful architecture has us manipulating resources via the URIs which uniquely identify them (nouns) and the HTTP request methods (verbs), instead of determining what action to take based on a separate field in the request:

GET    => show the resource
PUT    => update the resource
POST   => create a new resource
DELETE => destroy the resource

So now we come to Ruby on Rails. In Rails, PUT and DELETE are implemented by JavaScript, which changes your links into forms with a hidden field called _method. The form is received from the browser via POST, and then Rails looks for this field and decides whether to route the request to the PUT or DELETE methods of the controller.

Wait, what? That sounds suspiciously like — even exactly like — the behavior of a traditional web application, which receives all state-changing requests via POST and inspects specific fields to decide whether to destroy or modify a record.

So how can Rails’ approach be said to be RESTful at all, since under the hood, it is just a re-implementation of the “let’s POST everything” approach which REST specifically attempts to move away from?

And further, doesn’t this approach prevent my Rails app from ever degrading gracefully for people with JS turned off in the browser?

  • 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-06-08T16:55:21+00:00Added an answer on June 8, 2026 at 4:55 pm

    What makes a system RESTful or not isn’t so much the verb it uses, but the fact the interactions are driven by the hypermedia (in this case, this includes code-on-demand JavaScript).

    The GET/PUT/POST/DELETE mapping you’re quoting works fine for CRUD operations, but isn’t necessarily appropriate for everything (and isn’t necessarily supported by all browsers). This is a reasonable rule of thumb to design a RESTful system, but it’s neither sufficient nor necessary. (It’s in the same category of ideas as what people insist on when they want “RESTful” URIs: there’s no such thing.)

    Part of this comes under influence of books like RESTful Web Services. It’s a good book, but it came out at a time where WS-*/SOAP was predominant, and where everything was tunnelled through POST. A reaction to SOAP was to make people aware that there were other HTTP verbs they could use.

    For REST, what really matters in particular is to respect the notions behind the URI concept, the semantics of each HTTP verb (no side-effects, idempotent requests, …, where appropriate and if you’re using HTTP) and the HATEOS principle. It’s an architectural style, don’t stress too much about what POST/PUT/DELETE the JavaScript does underneath.

    You should certainly read these:

    • REST APIs must be hypertext-driven
    • It is okay to use POST

    EDIT: (Following comments)

    What I should have said was this: If most frameworks turn DELETE
    http://server.tld/resource/1 into POST
    http://server.tld/resource/1?_method=DELETE, then what’s the advantage
    of that approach over just using POST
    http://server.tld/resource/1?my_method=delete in the first place?

    • It makes the overall goal a little bit cleaner/clearer, in terms of API design. REST frameworks can ultimately only be as RESTful as one uses them, since REST is an architectural style, not a protocol or an implementation.
    • In addition, strictly speaking, the URI includes the query component, so http://server.tld/resource/1 and http://server.tld/resource/1?my_method=DELETE could identify different resources in principle (although that wouldn’t be a good design choice).
    • It’s good for the framework to be able to expose DELETE/PUT as such directly, but have a fallback solution via POST for the clients that don’t support it.

      The reason for this is that clients that do support DELETE/PUT will be able to make use of them, and make assumptions about their usage. It’s not so much of a problem for the client to treat a request as non-idempotent even if it was idempotent in principle as the opposite. If the client thinks it can send at most 1 request (non-idempotent) when it could have sent N+1 of the requests, this doesn’t cause major problems; if the client thinks it can send N+1 times the same request for something that shouldn’t be idempotent, this can cause quite a lot of problems. Emulating PUT through POST is OK, you’re just not making the most of PUT, emulating POST through PUT would be problematic.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I upgraded downgraded to rails 2.3.17 due to the security bugs, but now I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I want to construct a data frame in an Rcpp function, but when I
I need to clean up various Word 'smart' characters in user input, including but

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.