Sha256: 363ce349e8b3d2499d76eb6a391091902b879036f829263550d6cb9d8279d40d
Contents?: true
Size: 814 Bytes
Versions: 4
Compression:
Stored size: 814 Bytes
Contents
module Mobility module Sequel =begin Internal class used to force Sequel model to notice changes when mobility setter method is called. =end class ColumnChanges < Module # @param [Array<String>] attributes Backend attributes def initialize(*attributes) attributes.each do |attribute| define_method "#{attribute}=".freeze do |value, **options| if !options[:super] && send(attribute) != value locale = options[:locale] || Mobility.locale column = attribute.to_sym column_with_locale = :"#{attribute}_#{Mobility.normalize_locale(locale)}" @changed_columns = changed_columns | [column, column_with_locale] end super(value, **options) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems