提交 aa9da1fe 编写于 作者: V Vishnu Atrai 提交者: Xavier Noria

Active Resource - guide for create

上级 61899bff
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册