record_history 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +35 -35
- data/lib/record_history/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -11,39 +11,39 @@ rails g record_history:install
|
|
11
11
|
|
12
12
|
## Usage
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
14
|
+
# activate history logging for model
|
15
|
+
class Item < ActiveRecord::Base
|
16
|
+
has_record_history
|
17
|
+
end
|
18
|
+
|
19
|
+
# activate history logging for model (only for "name" field)
|
20
|
+
class Item < ActiveRecord::Base
|
21
|
+
has_record_history :only => [:name]
|
22
|
+
end
|
23
|
+
|
24
|
+
# activate history logging for model (except 'name' field)
|
25
|
+
class Item < ActiveRecord::Base
|
26
|
+
has_record_history :ignore => [:name]
|
27
|
+
end
|
28
|
+
|
29
|
+
# activate history logging for model (on update)
|
30
|
+
class Item < ActiveRecord::Base
|
31
|
+
has_record_history :on => [:update]
|
32
|
+
end
|
33
|
+
|
34
|
+
# get history for object
|
35
|
+
item = Item.first
|
36
|
+
history = item.first.record_history
|
37
|
+
history.first.old_value
|
38
|
+
hostory.first.new_value
|
39
|
+
|
40
|
+
|
41
|
+
# declare that User is author for some record_history items
|
42
|
+
class User < ActiveRecord::Base
|
43
|
+
is_record_history_author
|
44
|
+
end
|
45
|
+
|
46
|
+
# get record_history items created by user
|
47
|
+
User.first.written_history
|
48
|
+
|
49
49
|
|