method
save
v3.1.0 -
Show latest stable
-
0 notes -
Class: ActiveResource::Base
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3 (0)
- 2.1.0 (-1)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (-1)
- 3.0.9 (-1)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
save()
public
Saves (POST) or updates (PUT) a resource. Delegates to create if the object is new, update if it exists. If the response to the save includes a body, it will be assumed that this body is Json for the final object as it looked after the save (which would include attributes like created_at that weren’t part of the original submit).
Examples
my_company = Company.new(:name => 'RoleModel Software', :owner => 'Ken Auer', :size => 2) my_company.new? # => true my_company.save # sends POST /companies/ (create) my_company.new? # => false my_company.size = 10 my_company.save # sends PUT /companies/1 (update)