Module: ActiveRecord::CheckArrayBeforeUpdate
- Defined in:
- lib/ar_pg_array/allways_save.rb,
lib/ar_pg_array/allways_save.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
11 12 13 14 |
# File 'lib/ar_pg_array/allways_save.rb', line 11 def self.included(base) base.alias_method_chain :update, :check_array base.send(:alias_method, :_read_attribute, :read_attribute) end |
Instance Method Details
#mark_arrays_for_update ⇒ Object
3 4 5 6 7 |
# File 'lib/ar_pg_array/allways_save.rb', line 3 def mark_arrays_for_update @attributes_cache.each do |name, value| attribute_will_change!(name) if Array === value && _read_attribute(name) != value end end |
#update_with_check_array ⇒ Object
16 17 18 19 |
# File 'lib/ar_pg_array/allways_save.rb', line 16 def update_with_check_array mark_arrays_for_update update_without_check_array end |