method

destroy_row

Importance_0
destroy_row() private

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/locking/optimistic.rb, line 120
        def destroy_row
          return super unless locking_enabled?

          locking_column = self.class.locking_column

          delete_constraints = _primary_key_constraints_hash
          delete_constraints[locking_column] = _lock_value_for_database(locking_column)

          affected_rows = self.class._delete_record(delete_constraints)

          if affected_rows != 1
            raise ActiveRecord::StaleObjectError.new(self, "destroy")
          end

          affected_rows
        end
Register or log in to add new notes.