method

save

Importance_2
v2.2.1 - Show latest stable - 0 notes - Class: ActiveResource::Base
save() public

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 # sends POST /companies/ (create)

  my_company.new? # => false
  my_company.size = 10
  my_company.save # sends PUT /companies/1 (update)
Show source
Register or log in to add new notes.