Sha256: b537f6ec8b0562c5429f08d04d1f5c3e69a5d5a1b0b4a3e95bbbd5ec0225d2b1
Contents?: true
Size: 592 Bytes
Versions: 2
Compression:
Stored size: 592 Bytes
Contents
module ActiveRecord module CheckArrayBeforeUpdate def mark_arrays_for_update @attributes_cache.each do |name, value| attribute_will_change!(name) if Array === value && _read_attribute(name) != value end end end module CheckArrayBeforeUpdate def self.included(base) base.alias_method_chain :update, :check_array base.send(:alias_method, :_read_attribute, :read_attribute) end def update_with_check_array mark_arrays_for_update update_without_check_array end end Base.__send__ :include, CheckArrayBeforeUpdate end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ar_pg_array-0.10.2 | lib/ar_pg_array/allways_save.rb |
ar_pg_array-0.10.1 | lib/ar_pg_array/allways_save.rb |