Saves a record.

 @raise [Trello::Error] if the card could not be saved

 @return [String] The JSON representation of the saved card returned by
     the Trello API.
433155
def save
      # If we have an id, just update our fields.
      return update! if id

      from_response client.post("/cards", {
        name:   name,
        desc:   desc,
        idList: list_id,
        idMembers: member_ids,
        idLabels: card_labels,
        pos: pos,
        due: due,
        dueComplete: due_complete,
        idCardSource: source_card_id,
        keepFromSource: source_card_properties
      })
    end
1199864
def save(options={:validate => true})
      context = self.new_record? ? :create : :update
      return false if options[:validate] && !valid?(context)
      
      run_callbacks(context) do
        if context == :create
          key = self.class.persistence.insert(self)
        else
          key = self.class.persistence.update(self)
        end
        self.persist!
        key
      end
    end
1040775
def save(self, with_data=False):
        
        r = self._client.request('PUT', self.url, json=self._serialize(with_data=with_data))
        return self._deserialize(r.json(), self._manager)
671452
def upsert(&block)
      ActiveRecord::Base.transaction do
        yield
        @flash_notice = t('save_ok')
      end
      prepare_list
    rescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid => ex
      logger.info "#{ex.class.to_s}: #{@record.class.to_s}: #{@record.errors.full_messages.join(' / ')}"
      app_rescue
      @flash_error = t('save_fail')
    end
1035043
def save_card(self, card, cache=False):
        
        if cache:
            self.cache_card(card)
        carddict = card.save()
        with sqlite3.connect(self.dbname) as carddb:
            carddb.execute("DELETE from CARDS where code = ?",
                           (carddict["code"],))
            carddb.execute("INSERT INTO CARDS VALUES(?, ?, ?, ?, ?)",
                           [carddict[key] if isinstance(carddict[key], str)
                            else str(carddict[key]) for key in FIELDS])
657541
def save(self):
        
        record = self.record()
        if not record:
            logger.warning('No record has been defined for %s.' % self)
            return False
        
        if not self.signalsBlocked():
            self.aboutToSaveRecord.emit(record)
            self.aboutToSave.emit()
        
        values = self.saveValues()
        
        # ignore columns that are the same (fixes bugs in encrypted columns)
        check = values.copy()
        for column_name, value in check.items():
            try:
                equals = value == record.recordValue(column_name)
            except UnicodeWarning:
                equals = False
            
            if equals:
                check.pop(column_name)
        
        # check to see if nothing has changed
        if not check and record.isRecord():
            if not self.signalsBlocked():
                self.recordSaved.emit(record)
                self.saved.emit()
                self._saveSignalBlocked = False
            else:
                self._saveSignalBlocked = True
            
            if self.autoCommitOnSave():
                status, result = record.commit()
                if status == 'errored':
                    if 'db_error' in result:
                        msg = nativestring(result['db_error'])
                    else:
                        msg = 'An unknown database error has occurred.'
                    
                    QMessageBox.information(self,
                                            'Commit Error',
                                            msg)
                    return False
            return True
        
        # validate the modified values
        success, msg = record.validateValues(check)
        if ( not success ):
            QMessageBox.information(None, 'Could Not Save', msg)
            return False
        
        record.setRecordValues(**values)
        success, msg = record.validateRecord()
        if not success:
            QMessageBox.information(None, 'Could Not Save', msg)
            return False
        
        if ( self.autoCommitOnSave() ):
            result = record.commit()
            if 'errored' in result:
                QMessageBox.information(None, 'Could Not Save', msg)
                return False
        
        if ( not self.signalsBlocked() ):
            self.recordSaved.emit(record)
            self.saved.emit()
            self._saveSignalBlocked = False
        else:
            self._saveSignalBlocked = True
        
        return True
753327
def save_as_persisted_record
      new_attributes = attributes.reject { |k, _v| k.to_s =~ /^(id|uuid)$/ }
      self.class.update(id, new_attributes)
    end
583454
def serialize(self, cls, record):
        
        return json.dumps(record, cls=self.encoder)
149856
def update
      respond_to do |format|
        if record.update(record_params)
          format.html { redirect_to edit_record_path(record), notice: "#{model} was successfully updated." }
          format.json { render json: record, status: :ok }
        else
          format.html { render :edit }
          format.json { render json: record.errors, status: :unprocessable_entity }
        end
      end
    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
1109076
def createCard( self, parent, record ):
        
        cls = self.cardClass(record)
        if ( cls ):
            card = cls(parent)
            card.setRecord(record)
            return card
        return None
1057307
def save
      data = dump
      data = Sidekiq.dump_json(data)

      Sidekiq.redis do |conn|
        conn.multi do
          conn.setex(status_key, self.ttl, data)
          conn.zadd(self.class.statuses_key, Time.now.to_f.to_s, self.jid)
        end
      end
    end
1266144
def save!(options={:validate => true})
      unless save(options)
        raise Riagent::InvalidDocumentError.new(self)
      end
      true
    end
1087051
def save(opts={})
    options = { :validate => true }.merge(opts)
    return false if !(new_record? || changed?)
    if options[:validate]
      return false if !valid?
    end
    begin
      save!(options)
    rescue
      return false
    end
    true
  end
1235144
def persist
      future = nil
      set_id if new_record?
      callback = new_record? ? :create : :update

      self.class.transaction do |redis|
        run_callbacks :save do
          run_callbacks callback do
            redis.pipelined do
              attrs = coerced_attributes
              key = self.class.sti_child? ? self.class.sti_base_key_for(id) : self.class.key_for(id)
              future = attrs.any? ? redis.hmset(key, attrs) : :unchanged

              if new_record?
                if self.class.all_index_enabled?
                  redis.sadd(self.class.key_for(:all), id)
                  redis.sadd(self.class.sti_base_key_for(:all), id) if self.class.sti_child?
                end
                add_to_indexes(redis)
              else
                update_indexes(redis)
              end
            end
          end
        end
      end

      future
    end
1208446
public function save()
    {
        $json = [];
        foreach ($this as $cookie) {
            if ($cookie->getExpires() && !$cookie->getDiscard()) {
                $json[] = $cookie->toArray();
            }
        }

        $_SESSION[$this->sessionKey] = json_encode($json);
    }
670257
def serialize stuff
			if stuff.is_a? Array or stuff.is_a? ActiveRecord::Relation
				json = render_to_string json:QuickDryArraySerializer.new(stuff, root:get_model.model_name.route_key )
				hash = JSON.parse(json)
				temp = []
				if hash[get_model.model_name.route_key].first.has_key? get_model.model_name.route_key
					hash[get_model.model_name.route_key].each{|x| temp << x[get_model.model_name.route_key]}
					hash[get_model.model_name.route_key] = temp
					return hash.to_json
				end
				return json
			elsif stuff.is_a? get_model

			end
		end