aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorVishnu Atrai <vishnu.atrai@gmail.com>2011-08-01 20:48:45 +0530
committerXavier Noria <fxn@hashref.com>2011-08-13 16:22:13 -0700
commitaa9da1fe70a109f86922b4ee83039f1cae1e6584 (patch)
tree68ed3fae690751bff271305d0c626707bc27c0d3 /railties/guides/source
parent61899bff17e161dbd706bfb900ac212fe90c3acd (diff)
downloadrails-aa9da1fe70a109f86922b4ee83039f1cae1e6584.tar.gz
rails-aa9da1fe70a109f86922b4ee83039f1cae1e6584.tar.bz2
rails-aa9da1fe70a109f86922b4ee83039f1cae1e6584.zip
Active Resource - guide for create
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/active_resource_basics.textile11
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/guides/source/active_resource_basics.textile b/railties/guides/source/active_resource_basics.textile
index 8a36622814..e40ca4fc42 100644
--- a/railties/guides/source/active_resource_basics.textile
+++ b/railties/guides/source/active_resource_basics.textile
@@ -34,13 +34,22 @@ Read requests use the GET method and expect the JSON form of whatever resource/r
<ruby>
# Find a person with id = 1
-ryan = Person.find(1)
+person = Person.find(1)
# Check if a person exists with id = 1
Person.exists?(1) # => true
# Get all resources of Person class
Person.all
</ruby>
+h4. Create
+
+Creating a new resource submits the JSON form of the resource as the body of the request with HTTP POST method and parse the response into Active Resource object.
+
+<ruby>
+person = Person.create(:name => 'Vishnu')
+person.id # => 1
+</ruby>
+
h3. Changelog
* July 30, 2011: Initial version by "Vishnu Atrai":http://github.com/vatrai \ No newline at end of file