We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc94812 commit 505ad2bCopy full SHA for 505ad2b
active_model_dirty.rb
@@ -0,0 +1,29 @@
1
+class Person
2
+
3
+ include ActiveModel::Dirty
4
5
+ define_attribute_methods :name
6
7
+ def name
8
+ @name
9
+ end
10
11
+ def name=(val)
12
+ name_will_change! unless val == @name
13
+ @name = val
14
15
16
+ def save
17
+ # do persistence work
18
+ changes_applied
19
20
21
+ def reload!
22
+ # get the values from the persistence layer
23
+ clear_changes_information
24
25
26
+ def rollback!
27
+ restore_attributes
28
29
+end
0 commit comments