POST and GET

HEY Guys,

Im new to rails. Can someone help explain POST and GET inrails, and
maybe give an example? When is it used? Im learning rails via Agile web
Development with Rails, and soon to download peepcode video’s, are these
good resources to learn from?

Regards

C=create=post=insert
R=read=get=select
U=update=put=update
D=delete=delete=delete

POST & GET are part of the http standard. Check out the fielding
dissertation they’re two of I think 9 methods
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

When you submit a form without an opaque query string you are POSTing.
When
you grab the variables from a query string you are getting your GET on.

I just got the Agile WDwR beta copy. Interesting stuff. I would check
out
different API’s like Twitter, Gowalla, etc and see how they expose their
data/we seb service.

RESTful in peace,
angel

GET

POST

  • can only be generated by a form’s submit action/button
  • all the values (ie form arguments) get passed in the “params” hence
    in rails, you access the values via “params”
  • example: in search forms or registration forms, clicking the submit
    button generates a POST request to the web server

Gordon Y.

Also, a GET is just a read, while a POST is used to create. Like the
Wikipedia article linked before says:

Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications.

Adam S. wrote:

Also, a GET is just a read, while a POST is used to create. Like the
Wikipedia article linked before says:

Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications.

Thanks guys this really helped out alot, Thank You :slight_smile:

To add, in relation to a GET request, there is a limit of number of
characters that a url can be made of.
http://stackoverflow.com/questions/1496080/limitation-of-url

Cheers

Gordon Y. :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs