ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
Re: [Rails] restful interfaces and preserving PATH_INFO in custom dispatch/route
by Ara T Howard other posts by this author
Dec 4 2005 2:45PM messages near this date
Re: [Rails] restful interfaces and preserving PATH_INFO in custom dispatch/route | [Rails] ActiveRecord::Base#find(*a) - but no &b !?
On Sun, 4 Dec 2005, Julian 'Julik' Tarkhanov wrote:

> > 
> > any hints appreciated.
> 
>  map.connect 'rest/:format/:model/:action/:id
                                       ^
                                       ^
                                       ^

this is inferred from the REQUEST_METHOD.


the idea is that a url like

   http://127.0.0.1/rest/student/42

is used for all of PUT (create), GET (read), POST (edit), and DELETE (delete).

>  on the controller side
> 
>  def index
>     request.post? ? update_student : return_student
>  end

but a post can be either an insert or an update...

>  I think it should parse the params for you if they are YAML or XML but I'm
>  not sure.  Why would you want path-info here?

   http://127.0.0.1/rest/xml/student/42
                     ^    ^    ^^^^^^^
                     ^    ^    ^^^^^^^
                     ^    ^    ^^^^^^^

             controller action  path_info

but now i think i understand what you are getting at... maybe a

   map.connect 'rest/:format/:model/:id'

for a specific record

and

   map.connect 'rest/:format/:model/'

for all tuples.

but i'm new to routes and don't quite get the exact approach.

thanks for the idea.

-a
-- 
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================

_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Ara.T.Howard
Julian 'Julik' Tarkhanov
Ara T Howard

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved