Module: Toy::DirtyStore
Instance Method Summary
collapse
#adapter, #delete, #destroy, #destroyed?, #initialize, #initialize_copy, #new_record?, #persist, #persisted?, #persisted_attributes, #persisted_id, #update_attributes
Instance Method Details
#initialize_from_database ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/toy/dirty_store.rb', line 9
def initialize_from_database(*)
super
@previously_changed = {}
@changed_attributes.clear if @changed_attributes
self
end
|
18
19
20
21
22
23
|
# File 'lib/toy/dirty_store.rb', line 18
def reload
super.tap do
@previously_changed = {}
@changed_attributes = {}
end
end
|
#save(options = {}) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/toy/dirty_store.rb', line 25
def save(options={})
super.tap do
@previously_changed = changes
@changed_attributes.clear if @changed_attributes
end
end
|