Module: DatastaxRails::Types::DirtyCollection

Extended by:
ActiveSupport::Concern
Included in:
DynamicList, DynamicMap, DynamicSet
Defined in:
lib/datastax_rails/types/dirty_collection.rb

Overview

An extension to normal arrays and hashes that allow for tracking of dirty values. This is used by ActiveModel's change tracking framework.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ignore_modificationsObject

FIXME: How do we make this thread-safe?



44
45
46
47
48
49
50
# File 'lib/datastax_rails/types/dirty_collection.rb', line 44

def self.ignore_modifications
  original = dsr_ignore_modifications
  self.dsr_ignore_modifications = true
  result = yield
  self.dsr_ignore_modifications = original
  result
end

Instance Method Details

#delete(obj) ⇒ Object



37
38
39
40
41
# File 'lib/datastax_rails/types/dirty_collection.rb', line 37

def delete(obj)
  modifying do
    super
  end
end

#initialize(record, name, collection) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/datastax_rails/types/dirty_collection.rb', line 29

def initialize(record, name, collection)
  @record   = record
  @name     = name.to_s

  super(collection)
  organize_collection
end