Module: ActiveRecord::Turntable::ActiveRecordExt::Relation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_record/turntable/active_record_ext/relation.rb
Instance Method Summary collapse
Instance Method Details
#_update_record_with_turntable(values, id, id_was, turntable_scope = nil) ⇒ Object
Note:
Override to add sharding scope on updating
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_record/turntable/active_record_ext/relation.rb', line 19 def _update_record_with_turntable(values, id, id_was, turntable_scope = nil) # :nodoc: substitutes, binds = substitute_values values condition_scope = @klass.unscoped.where(@klass.arel_table[@klass.primary_key].eq(id_was || id)) condition_scope = condition_scope.merge(turntable_scope) if turntable_scope um = condition_scope.arel.compile_update(substitutes, @klass.primary_key) @klass.connection.update( um, 'SQL', binds) end |