lib/jsonapi/consumer/resource.rb
def save
      return false unless valid?

      self.last_result_set = if persisted?
        self.class.requestor.update(self)
      else
        self.class.requestor.create(self)
      end

      if last_result_set.has_errors?
        fill_errors
        false
      else
        self.errors.clear if self.errors
        mark_as_persisted!
        if updated = last_result_set.first
          self.attributes = updated.attributes
          self.links.attributes = updated.links.attributes
          self.relationships.attributes = updated.relationships.attributes
          clear_changes_information
        end
        true
      end
    end
def save
      return false unless valid?

      self.last_result_set = if persisted?
        self.class.requestor.update(self)
      else
        self.class.requestor.create(self)
      end

      if last_result_set.has_errors?
        fill_errors
        false
      else
        self.errors.clear if self.errors
        mark_as_persisted!
        if updated = last_result_set.first
          self.attributes = updated.attributes
          self.links.attributes = updated.links.attributes
          self.relationships.attributes = updated.relationships.attributes
          clear_changes_information
        end
        true
      end
    end
def save return false unless valid? self . last_result_set = if persisted? self . class . requestor . update ( self ) else self . class . requestor . create ( self ) end if last_result_set . has_errors? fill_errors false else self . errors . clear if self . errors mark_as_persisted! if updated = last_result_set . first self . attributes = updated . attributes self . links . attributes = updated . links . attributes self . relationships . attributes = updated . relationships . attributes clear_changes_information end true end end
Commit the current changes to the resource to the remote server.
 If the resource was previously loaded from the server, we will
 try to update the record. Otherwise if it's a new record, then
 we will try to create it

 @return [Boolean] Whether or not the save succeeded
Commit the current changes to the resource to the remote server . If the resource was previously loaded from the server we will try to update the record . Otherwise if it s a new record then we will try to create it