aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
Diffstat (limited to 'railties/guides')
-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