Set a hash of model attributes, and sync the model to the server. If the server returns an attributes hash that differs, the model's state will be `set` again.
497670
function(key, val, options) {
      var attrs, current, done;

      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (key == null || _.isObject(key)) {
        attrs = key;
        options = val;
      } else if (key != null) {
        (attrs = {})[key] = val;
      }
      options = options ? _.clone(options) : {};

      // If we're "wait"-ing to set changed attributes, validate early.
      if (options.wait) {
        if (attrs && !this._validate(attrs, options)) return false;
        current = _.clone(this.attributes);
      }

      // Regular saves `set` attributes before persisting to the server.
      var silentOptions = _.extend({}, options, {silent: true});
      if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) {
        return false;
      }

      // Do not persist invalid models.
      if (!attrs && !this._validate(null, options)) return false;

      // After a successful server-side save, the client is (optionally)
      // updated with the server-side state.
      var model = this;
      var success = options.success;
      options.success = function(resp, status, xhr) {
        done = true;
        var serverAttrs = model.parse(resp);
        if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
        if (!model.set(serverAttrs, options)) return false;
        if (success) success(model, resp, options);
      };

      // Finish configuring and sending the Ajax request.
      var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
      if (method == 'patch') options.attrs = attrs;
      var xhr = this.sync(method, this, options);

      // When using `wait`, reset attributes to original values unless
      // `success` has been called already.
      if (!done && options.wait) {
        this.clear(silentOptions);
        this.set(current, silentOptions);
      }

      return xhr;
    }
752190
def add_attributes(hash)
      hash.each_pair do |k,v|
        k = k.to_sym
        #raise DuplicateAttribute.new("#{k}") unless (k == :id or !self.respond_to?(k))
        if k == :id or !self.respond_to?(k)
          @cached_attrs[k] = v
          meta = class << self; self; end
          meta.send(:define_method, k) { @cached_attrs[k] }
          meta.send(:define_method, "#{k}=") do |new_value| 
            @cached_attrs[k] = new_value.is_a?(RedisRecord::Model) ? new_value.id : new_value
            @stored_attrs.delete(k)
          end
        end
      end
      hash
    end
531837
def update_attributes(self, updates):
        """"""
        if not isinstance(updates, dict):
            updates = updates.to_dict()
        for sdk_key, spec_key in self._get_attributes_map().items():
            attr = '_%s' % sdk_key
            if spec_key in updates and not hasattr(self, attr):
                setattr(self, attr, updates[spec_key])
884178
def hash_to_model(klass_name, hash)
      model_klass =
        if self.class.const_defined?("#{self.class}::#{klass_name}")
          self.class.const_get(klass_name)
        else
          self.class.const_set(klass_name, Class.new(HashModel))
        end
      model_klass.new(hash)
    end
551658
def attributes
      (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|
        hash[key] = read_attribute(key)
        hash
      end
    end
165426
def update_attributes_without_saving(hash)
      hash.each do |k, v|
        raise NoMethodError, "#{k}= method not available, use property :#{k}" unless self.respond_to?("#{k}=")
      end      
      hash.each do |k, v|
        self.send("#{k}=",v)
      end
    end
392454
def set_model(self, model):
        
        self._model = model

        self._query.from_(model.get_table())

        return self
617242
def model_setattr():
    

    def model_setattr(value, context, **_params):
        setattr(context["model"], context["key"], value)
        return _attr()

    return model_setattr
374285
def assign_attributes(new_attributes = {}, options = {})
      return if new_attributes.blank?

      attributes = new_attributes.stringify_keys
      multi_parameter_attributes = []
      nested_parameter_attributes = []

      attributes.each do |k, v|
        if k.include?("(")
          multi_parameter_attributes << [ k, v ]
        elsif respond_to?("#{k}=")
          if v.is_a?(Hash)
            nested_parameter_attributes << [ k, v ]
          else
            send("#{k}=", v)
          end
        else
          raise UnknownAttributeError, "unknown attribute: #{k}"
        end
      end

      # assign any deferred nested attributes after the base attributes have been set
      nested_parameter_attributes.each do |k,v|
        send("#{k}=", v)
      end

      assign_multiparameter_attributes(multi_parameter_attributes)
    end
161262
def update(other_hash)
      if other_hash.is_a? Hash
        super(other_hash)
      else
        other_hash.to_hash.each_pair do |key, value|
          if block_given?
            value = yield(key, value)
          end
          self[key] = value
        end
        self
      end
    end
985294
def model
      @model ||= begin
        model = find_or_build_model

        set_attributes(model)

        after_build_blocks.each { |block| instance_exec(model, &block) }
        model
      end
    end
243285
def synchronize! updater
      source_hash[updater.filename] = source_hash[updater.filename].synchronize(updater)
    end
1050619
def reload(self):
        
        new_model = self.collection.get(self.id)
        self.attrs = new_model.attrs
235718
def _set_state_from_serializeable_fields_and_state(self, state, klass):
        
        if _debug:
            logger.debug("restoring state for class %s", klass)

        for field in SerializableMixIn._get_serialize_fields(klass):
            if field in state:
                # ensure we can set attributes. Log culprits.
                try:
                    setattr(self, field, state.get(field))
                except AttributeError:
                    logger.debug('field: %s', field, exc_info=True)
            else:
                if _debug:
                    logger.debug("skipped %s, because it is not contained in state", field)
1282034
def set(key, value = nil)
      if key.is_a?(Hash)
        properties.merge!(key)
      else
        properties[key] = value
      end
    end
986056
def attributes=(attributes)
      model = self.model
      attributes.each do |name, value|
        case name
          when String, Symbol
            if model.allowed_writer_methods.include?(setter = "#{name}=")
              __send__(setter, value)
            else
              raise ArgumentError, "The attribute '#{name}' is not accessible in #{model}"
            end
          when Associations::Relationship, Property
            # only call a public #typecast (e.g. on Property instances)
            if name.respond_to?(:typecast)
              value = name.typecast(value)
            end
            self.persistence_state = persistence_state.set(name, value)
        end
      end
    end
73980
def assign_attributes(new_attributes)
      if !new_attributes.respond_to?(:stringify_keys)
        raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."
      end
      return if new_attributes.empty?

      # stringify keys just like https://github.com/rails/rails/blob/4f99a2186479d5f77460622f2c0f37708b3ec1bc/activemodel/lib/active_model/attribute_assignment.rb#L34
      new_attributes.stringify_keys.each do |k, v|
        setter = :"#{k}="
        if respond_to?(setter)
          public_send(setter, v)
        else
          _attr_json_write_unknown_attribute(k, v)
        end
      end
    end