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
:nodoc:
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 scope = @klass.unscoped if @klass.finder_needs_type_condition? scope.unscope!(where: @klass.inheritance_column) end relation = scope.where(@klass.primary_key => (id_was || id)) relation = relation.merge(turntable_scope) if turntable_scope bvs = binds + relation.bind_values um = relation .arel .compile_update(substitutes, @klass.primary_key) @klass.connection.update( um, 'SQL', bvs, ) end |