BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News REST changes in Rails Edge and RADAR

REST changes in Rails Edge and RADAR

The development version of Ruby on Rails, Rails Edge, was updated with a change to the code that handles REST URLs. From the commit message for this change:"

Dropped the use of ; as a separator of non-crud actions on resources and went back to the vanilla slash. It was a neat idea, but lots of the non-crud actions turned out not to be RPC (as the ; was primarily intended to discourage), but legitimate sub-resources, like /parties/recent, which didn't deserve the uglification of /parties;recent. Further more, the semicolon caused issues with caching and HTTP authentication in Safari. Just Not Worth It [DHH]"

Ryan Daigle gives a succinct overview of what this means:

Whenever you have a custom action route defined in Rails:
map.resources :users, :collection => { :filter => :get }
the resulting route no longer uses a semi-colon (;) to delimit the custom action:
GET /users;filter
and instead will use your standard forward-slash (/):
GET /users/filter

Dave Thomas (PragDave) also reported these news and offered a thorough explanation of the reasons that made the semicolons seem necessary in the first place. After detailing that it's only Web Browsers that require hacks like this, he ponders a solution for the problem:

Put the main application logic into a RESTful server. This is where all the CRUD-style access to resources takes place. Then, write a second proxy server. This is an HTTP filter, sitting between dumb browsers and your core resources. When browser-based users need to interact with your resources, they actually connect to this proxy. It then talks REST to your main server, and interprets the RESTful responses back into a form that's useful on the browser. And this filter doesn't have to be a dumb presentation layer - there's nothing to say that it can't handle additional functionality as well. Things like menus, user preferences, and so on could all sit here.

Since he likens Web Browsers to old 3270 terminals, also referred to as dumb clients, he names this idea "RADAR": RESTful Application talking to Dumb-Ass Recipients.

Rate this Article

Adoption
Style

BT