Saves the resource

 @return [Boolean]
   true if the resource was successfully saved

 @api semipublic
16300
def save_self(execute_hooks = true)
      # short-circuit if the resource is not dirty
      return saved? unless dirty_self?

      if execute_hooks
        new? ? create_with_hooks : update_with_hooks
      else
        _persist
      end
      clean?
    end
1234741
def save
      run_callbacks(:before_save)
      run_callbacks(:before_create) unless self.is_created

      existing_items = self.class.all
      if self.new_record?
        existing_items << self
      else # update existing record
        updated_item = existing_items.find { |item| item.id == self.id }
        return false unless updated_item
        updated_item.attributes = self.attributes
      end

      raw_data = existing_items ? existing_items.map { |item| item.persisted_attributes } : []
      self.class.write_contents(raw_data) if self.valid?

      run_callbacks(:after_create) unless self.is_created
      run_callbacks(:after_save)
      true
    rescue IOError
      false
    end
1331785
public function save()
    {
        $requestor = new ApiRequestor();
        $params = $this->serializeParameters();
        self::_validateCall( 'save', $params );
        unset( $params['id'] );

        if( count( $params ) > 0 )
        {
            $url = '/' . $this->getType() . '/' . $this->id;
            return $requestor->request('put', $url, $params);
        }

        return true;
    }
191748
def save(filename, path, params={})
      payload = get! path, nil, params
      File.write filename, payload.response.body
    end
1272582
def save!
      response = HTTParty.put("#{users_base_path}/#{id}", timeout: timeout, headers: headers, body: to_json)
      get_body_from(response)
    end
850313
public function save()
	{
		// Make sure children inherit states
		if ($this->get('state') == self::STATE_DELETED
		 || $this->get('state') == self::STATE_UNPUBLISHED)
		{
			foreach ($this->replies()->rows() as $comment)
			{
				$comment->set('state', $this->get('state'));

				if (!$comment->save())
				{
					$this->addError($comment->getError());

					return false;
				}
			}
		}

		return parent::save();
	}
494465
public function save()
    {
        $this->load();
        // Do the work in case we have only changed hash
        if ($this->isChanged()) {
            @chmod($this->path, 0777);
            return file_put_contents($this->path, $this->fileType->render($this->config));
        } else {
            return true;
        }
    }
541174
def save_and_respond(resource, options={}, &block)
      creation = resource.new_record?
      resource.attributes = options[:attributes] unless options[:attributes].nil?
      respond_to do |format|
        # if ((block_given? and block.arity == 1) ? yield(resource) : (block_given? and block.arity == 2) ? yield(resource, format) : resource.save)
        if (block_given? ? yield(resource, format) : resource.save)
          status = (creation ? :created : :ok)
          response.headers["X-Return-Code"] = "success"
          response.headers["X-Saved-Record-Id"] = resource.id.to_s
          format.html { params[:dialog] ? head(status) : redirect_to(options[:url] || resource) }
          format.json { render :json => resource.to_json, :status => status, :location => resource}
          format.xml  { render  :xml => resource.to_xml,  :status => status, :location => resource }
        else
          response.headers["X-Return-Code"] = "invalid"
          format.html { render :action => (resource.new_record? ? "new" : "edit")}
          format.json { render :json => resource.errors.to_json, :status => :unprocessable_entity }
          format.xml  { render  :xml => resource.errors.to_xml,  :status => :unprocessable_entity }
        end
      end
    end
1008560
def save
      # Don't save default values
      save_config = Rails.application.config.theme.reject { |k, _| @defaults.keys.include?(k) }
      full_config[Rails.env].merge!(save_config)
      File.open(config_pathname, 'w') { |f| f << full_config.to_yaml }
    end
886043
def save
      response = service.send(:"#{method_prefix}_update", self.attrs)

      if response.at_xpath('//status').attr('code') == 'ok'
        # Load the ID if this was a creation
        self.id = response.at_xpath("//#{ac_obj_node_name}").attr("#{ac_obj_type}-id") if self.id.nil?
        true
      else
        save_errors(response)
        false
      end
    end
526007
def save
      if data = session[Evercookie.hash_name_for_get]
        if data[:key] && cookies[data[:key]]
          session[Evercookie.hash_name_for_saved] =
              { data[:key] => cookies[data[:key]] }
        end
      end
      render nothing: true
    end
466032
def save(self):
        

        if not self.id:
            save_method = Panoptes.client().post
            force_reload = False
        else:
            if not self.modified_attributes:
                return
            if not self._loaded:
                self.reload()
            save_method = Panoptes.client().put
            force_reload = True

        response, response_etag = save_method(
            self.url(self.id),
            json={self._api_slug: self._savable_dict(
                modified_attributes=self.modified_attributes
            )},
            etag=self.etag
        )

        raw_resource_response = response[self._api_slug][0]
        self.set_raw(raw_resource_response, response_etag)

        if force_reload:
            self._loaded = False

        return response
701160
def save_grid_service(grid_service)
      if grid_service.save
        return grid_service
      else
        grid_service.errors.each do |key, message|
          add_error(key, :invalid, message)
        end
        return nil
      end
    end
1118382
public function save()
    {
        $data = $this->getData();
        if ($this->_collection->save($data, ["j" => true])['err'] === null) {
            $this->_id = $data['_id'];
            $this->_cache->store(static::getCollection()."_{$this->_id}", $data);
            return true;
        }
        // @codeCoverageIgnoreStart
        return false;
        // @codeCoverageIgnoreEnd
    }
218953
public function save()
    {
        if ($this->validate()) {
            $user = $this->getUser();
            if(AvatarHelper::save($user, $this->getOriginalImage())){
                return true;
            } else {
                return false;
            }
        }
        return false;
    }
762632
public function save():bool
    {
        $_SESSION = $this->session;
        return (0 === count(array_diff($this->session, $_SESSION)))? true : false;
    }
760015
public function saveCurrent()
    {
        if ($this->saveEnabled() && $this->isViewValid() && $this->isViewUnique())
        {
            $success = $this->saveCurrentModel();

            // Keep on only if the model save has succeeded
            if ($success)
            {
                $this->storeCurrentHash();

                $this->saveTrackables(
                    $this->getCurrent(),
                    $success
                );
            }

            return $success;
        }

        return false;
    }