lib/kasket.rb in kasket-4.2.0 vs lib/kasket.rb in kasket-4.2.1

- old
+ new

@@ -37,6 +37,21 @@ end def self.cache @cache_store ||= Rails.cache end + + # Keys are the records being saved. + # Values are either the saved record, or nil if the record has been destroyed. + def self.pending_records + Thread.current[:kasket_pending_records] + end + + def self.add_pending_record(record, destroyed = false) + Thread.current[:kasket_pending_records] ||= {} + Thread.current[:kasket_pending_records][record] = destroyed ? nil : record + end + + def self.clear_pending_records + Thread.current[:kasket_pending_records] = nil + end end