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
|
# File 'lib/ubiquitously/models/service/post/loggable.rb', line 15
def loggable
before_create do
unless valid?
logger.info "[invalid] #{errors.full_messages}"
return false
end
authorize
return false unless new_record?
logger.info "[create:before] #{tokenize.inspect}"
end
after_create do
logger.info "[create:after] #{tokenize.inspect}"
end
before_update do
unless valid?
logger.info "[invalid] #{errors.full_messages}"
return false
end
authorize
logger.info "[update:before] #{tokenize.inspect}"
end
after_update do
logger.info "[update:after] #{tokenize.inspect}"
end
end
|