logga 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logga/active_record.rb +9 -3
- data/lib/logga/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae0ca451a0ea14aa19f57a87183fcb0311eff29
|
4
|
+
data.tar.gz: 5c970997159c359fad7bb552080afaddf998b580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47a3115e724d308d70d6e3b4c904a9d32c6e54561e7fb2fb169045ef37d48c6843f72db676ff5f6368ab880ac09afa0a4f3f53c2fd2bf24d6fca7bad2246fa15
|
7
|
+
data.tar.gz: c8701154a50b687b5eca8be21c251483622bbe8cb0b2766a80a7c796a555840210c24af989921f764f0d0acda2fe62184d4ae64b6c585f8b9632acd370be8dcd
|
data/lib/logga/active_record.rb
CHANGED
@@ -50,6 +50,8 @@ module Logga
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
private
|
54
|
+
|
53
55
|
def author_data
|
54
56
|
data = Hash(log_receiver.try(:author) || try(:author)).with_indifferent_access
|
55
57
|
{
|
@@ -61,20 +63,24 @@ module Logga
|
|
61
63
|
|
62
64
|
def default_creation_log_body(record)
|
63
65
|
[
|
64
|
-
"#{record
|
66
|
+
"#{titleized_model_class_name(record)} created",
|
65
67
|
("(#{record.state})" if record.try(:state))
|
66
68
|
].compact.join(' ')
|
67
69
|
end
|
68
70
|
|
69
71
|
def default_change_log_body(record, field, old_value, new_value)
|
70
|
-
"#{record
|
72
|
+
"#{titleized_model_class_name(record)} #{field} set to #{new_value}"
|
71
73
|
end
|
72
74
|
|
73
75
|
def default_deletion_log_body(record)
|
74
76
|
[
|
75
|
-
"#{record
|
77
|
+
"#{titleized_model_class_name(record)} removed",
|
76
78
|
("(#{record.name})" if record.try(:name))
|
77
79
|
].compact.join(' ')
|
78
80
|
end
|
81
|
+
|
82
|
+
def titleized_model_class_name(record)
|
83
|
+
record.class.name.demodulize.titleize
|
84
|
+
end
|
79
85
|
end
|
80
86
|
end
|
data/lib/logga/version.rb
CHANGED