Sha256: 00f2d68301be33209426370f32833a4c03a098fd3989e3c71b14d156721adf76
Contents?: true
Size: 598 Bytes
Versions: 9
Compression:
Stored size: 598 Bytes
Contents
module Callbacks class ViewableAfterDestroy include Restrictor def init @range = (m.position + 1)..Float::INFINITY end def call update_list m.other_locales.each do |viewable| viewable.destroy! update_list(viewable.locale) end end private def update_list(locale = nil) query = m.list(locale).where(unique_keys: { position: @range }).order('unique_keys.position') query.each.with_index(m.position) do |viewable, position| viewable.unique_key.update_column(:position, position) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems