A method to save (POST) or update (PUT) a resource. It delegates to create if a new object, update if it is existing. If the response to the save includes a body, it will be assumed that this body is XML 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 # => POST /companies/ (create) my_company.new? # => false my_company.size = 10 my_company.save # => PUT /companies/1 (update)
Source Code
# File active_resource/base.rb, line 650 def save new? ? create : update end
<code/>and<pre/>for code samples.