Sha256: 2ed8018af779b7b9d988b215c59740f55bdda9ad9b96996109c0da46396a9263
Contents?: true
Size: 939 Bytes
Versions: 4
Compression:
Stored size: 939 Bytes
Contents
module Mobility module Sequel =begin Internal class used to force Sequel model to notice changes when +mobility_set+ is called. =end class ColumnChanges < Module # @param [Array<String>] attributes Backend attributes def initialize(attributes) @attributes = attributes define_method :mobility_set do |attribute, value, locale: Mobility.locale| if attributes.include?(attribute) column = attribute.to_sym column_with_locale = :"#{attribute}_#{Mobility.normalize_locale(locale)}" if mobility_get(attribute) != value @changed_columns << column_with_locale if !changed_columns.include?(column_with_locale) @changed_columns << column if !changed_columns.include?(column) end end super(attribute, value, locale: locale) end private :mobility_set end end end end
Version data entries
4 entries across 4 versions & 1 rubygems