method

_update_record

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: ClassMethods
_update_record(values, constraints) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/persistence.rb, line 500
      def _update_record(values, constraints) # :nodoc:
        constraints = constraints.map { |name, value| predicate_builder[name, value] }

        default_constraint = build_default_constraint
        constraints << default_constraint if default_constraint

        if current_scope = self.global_current_scope
          constraints << current_scope.where_clause.ast
        end

        um = Arel::UpdateManager.new(arel_table)
        um.set(values.transform_keys { |name| arel_table[name] })
        um.wheres = constraints

        connection.update(um, "#{self} Update")
      end
Register or log in to add new notes.