On Fri Jun 22, 2007 at 04:51:37PM +0200, Gregor Schmidt wrote:
> Hello,
> 
> I'm not yet a camping guru nor a RESTafarian, but I try.
> 
> Currently I'm trying to build a rest-style web app with sleeping
> bag/camping and I may successfully access the index, show, new, create
> and edit methods, that are provided with sleeping bag. But I don't
> know, how to build a form or link to access destroy and update.
> 
> I think this is mainly because of the corresponding HTTP verbs, that
> are supposed to be used. But unfortunately PUT and DELETE are not
> supported by browsers.

WebKit and Firefox both take just about any string as the method name. at least 
if youre submitting with XHR

which is good, because then you can use appropriately named methods in your 
camping app, instead of laying things inside other protocols (Atom/Bayeux) or 
resorting to URL and form field hacks (Rails)..


> I cannot make it work, neither can I
> find any hints on that issue in the source of sleeping bag.

if you want to emulate rails. why not just use Rails? do you like jumping 
through hoops to be tied to arbitrary ORMs* and additionally emulations of said 
ORMs frontend-facilitating features on another framework?


* and ORMs that tie you to a static schema and want you to only update it once 
every quarter during a migration-festival and hope you got all the new fields 
right... and the fields are just arbitrary strings rather than anything more 
meaningful to the web at large..


> Does anybody know, how I can build a link/form to update and destroy?

i generate the form clientside, cache the old value, and submit PATCH methods 
with the new value. this makes more sense than PUT, but PATCH appeared in some 
draft version f the HTTP1.1 RFC then disappeared, or something.


im pretty sure mongrel was trying to eat anything that wasnt PUT/POST/GET last 
i tried though. i think i may have reluctantly switched to a less sensical name 
beacuse i couldnt figure out how to make mongrel not toss the reqs..


as for REST, i tend to just use the request URI as an implicit subject (object 
ID) for the other operations. it helps if youre using HTTP URIs for everything 
including properties, otherwise you have to have a mapping layer somewhere.


> 
> Thanks for these great tools, both camping and sleeping bag feel as
> lightweight as it gets.
> 
> Cheers,
> 
> Gregor
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to