I am having a heck of a time understanding the new rest craze in rails. what I think I understand so far: 1 rest is about the way we use http to access information on the internet. 2 http was created with nouns and verbs in mind, but the only verbs that are supported in browsers and server software today are ''post'' and ''get''. Other useful verbs include put and delete. 3 a url should only contain nouns. They should identify a resource. Along with the url should be a ''method'' which should contain a verb that describes what we want to do with the resource. I have done a lot of reading but thats the best I can come up with so far... And what I REALLY don''t understand is the new ActiveResource stuff in rails. We want rails to be more rest oriented. We can''t rely on ''put'' and ''delete'' so rails tries to implement restful requests for us. But all its really doing is tacking the verb onto the url for us. So why cant the verb just be attached like ''person/delete''. Why all the semicolons and ampersands. And what makes this approach any different than calling it an ''action''? Any help would be greatly appreciated. -- Posted via http://www.ruby-forum.com/.
Well.. I''m not really answering your question about REST. Pretty new thing for me and I have not gotten everything clearly. Good info is at: http://www.ryandaigle.com/articles/2006/06/30/whats-new-in-edge-rails-activeresource-is-here But what the ActiveResource functionality by itself is more about how you access REST data. At least it''s how I understand it. Other things handle the creation of RESTful services. Thus enabling you to access RESTful datastores from like say Amazon in a similar way as you would access local database models. If you make a REST model to Amazon called AmazonBook. You would be able to do things like: book = AmazonBook.find(097669400X) book.name # Returns: "Agile Web Development with Rails" book.author[0].name # Returns: "Dave Thomas" Am I getting this right people???? Or am I misunderstanding everything?!??!? On 7/1/06, john <john@johnjohn.com> wrote:> I am having a heck of a time understanding the new rest craze in rails. > > what I think I understand so far: > 1 rest is about the way we use http to access information on the > internet. > > 2 http was created with nouns and verbs in mind, but the only verbs that > are supported in browsers and server software today are ''post'' and > ''get''. Other useful verbs include put and delete. > > 3 a url should only contain nouns. They should identify a resource. > Along with the url should be a ''method'' which should contain a verb that > describes what we want to do with the resource. > > I have done a lot of reading but thats the best I can come up with so > far... > > And what I REALLY don''t understand is the new ActiveResource stuff in > rails. We want rails to be more rest oriented. We can''t rely on ''put'' > and ''delete'' so rails tries to implement restful requests for us. But > all its really doing is tacking the verb onto the url for us. So why > cant the verb just be attached like ''person/delete''. Why all the > semicolons and ampersands. And what makes this approach any different > than calling it an ''action''? > > Any help would be greatly appreciated. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -------------- Jon Gretar Borgthorsson http://www.jongretar.net/
J?n Borg??rsson, thank you for your reply. It did help me. I still don''t understand what exactly is going on unfortunately. I wonder especially why we need the strange urls. What is the difference between a request like ''amazonbook/1/edit'' and a request like ''amazonbook/1;edit''? I had read the article you pointed me to, but I re-read it just now. I must be missing something important here I feel. I still have a hard time understanding all of this. With REST we can use a protocol that both machines and humans can use to interact with information. Thats because its a protocol and not just a bunch of words between slashes that a single website can interpret? Can we now interact with other web services as if they were active records? Is that what you meant? I don''t know, maybe I should accept that Im just not able to even formulate a proper question about ActiveResource and basically give up and wait for more blogs and such. But thanks for your help. Much appreciated!!!! On a side note: One of my favorite articles so far about REST was (don''t laugh) ''How I Explained REST To My Wife'': http://naeblis.cx/rtomayko/2004/12/12/rest-to-my-wife good stuff.> Good info is at: > http://www.ryandaigle.com/articles/2006/06/30/whats-new-in-edge-rails-activeresource-is-here-- Posted via http://www.ruby-forum.com/.
On 7/1/06, john <john@johnjohn.com> wrote:> What is the difference > between a request like ''amazonbook/1/edit'' and a request like > ''amazonbook/1;edit''?After reading DHH''s recent blog I wondered and am still wondering exactly the same thing.> On a side note: One of my favorite articles so far about REST was (don''t > laugh) ''How I Explained REST To My Wife'': > http://naeblis.cx/rtomayko/2004/12/12/rest-to-my-wifeWhat I got out of that article is the guy wants us to use standard verbs (GET, PUT etc). DHH mentioned that in his slides, I believe. I don''t get REST yet either. Peter