effective_logging 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad6d1fb9c0e708830f7ec12173354a1e6692fa0a
4
- data.tar.gz: 89c073378f6b6f441a2daa78ce034671a6e92db3
3
+ metadata.gz: c56031f528265bd29b5ad3e5a6777f87c15275a1
4
+ data.tar.gz: 9dd9730ea1237141d1ef8772928c65317fdf21ea
5
5
  SHA512:
6
- metadata.gz: 50d647c3c66443229c8a0aa26a2c58086e5a24d8f662753b2d5567d4ab9315a79bdc4c72d4b0882849611c26057a79f5c02a100083376f2aa2aa735096cc952e
7
- data.tar.gz: 33a0d6419f26c57ccae3abe1491273c5dfa6680ec26b3be93bd1615630560a94747a2b161110738c3fb4a64ff5933af14b5fbd96ec056fce4adb7b987b3e9f43
6
+ metadata.gz: 0ec3e3de1a369e7d40d5974b605032bd495ccc465519adfed4b6ff22d8a4350b12f4844ab5af6d2c86aa8ed9703fe2aa8f69ce289ef21d6860e761650e47b650
7
+ data.tar.gz: e1416af20d48313956c5e1adb4db2be10105f76af08149458cfa57b77216d7dadede1776225f99e75f4817d93ad99e827fbeefedc0fee9ca9990000ba0368b97
data/README.md CHANGED
@@ -212,7 +212,7 @@ And to your controller:
212
212
 
213
213
  ```ruby
214
214
  class ApplicationController < ActionController::Base
215
- set_log_changes_user
215
+ before_action :set_log_changes_user
216
216
  end
217
217
  ```
218
218
 
@@ -16,8 +16,9 @@ module ActsAsLoggable
16
16
  included do
17
17
  has_many :logged_changes, -> { where(status: EffectiveLogging.log_changes_status) }, as: :associated, class_name: Effective::Log
18
18
 
19
- before_save do
19
+ around_save do |_, block|
20
20
  @acts_as_loggable_new_record = new_record?
21
+ block.call
21
22
  EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).changed! unless @acts_as_loggable_new_record
22
23
  true
23
24
  end
@@ -63,7 +63,7 @@ module EffectiveLogging
63
63
  (resource.class.try(:reflect_on_all_autosave_associations) || []).each do |association|
64
64
  child_name = association.name.to_s.singularize.titleize
65
65
 
66
- resource.send(association.name).each_with_index do |child, index|
66
+ Array(resource.send(association.name)).each_with_index do |child, index|
67
67
  ActiveRecordLogger.new(child, options.merge(logger: logger, depth: (depth + 1), prefix: "#{child_name} ##{index+1}: ")).execute!
68
68
  end
69
69
  end
@@ -86,7 +86,7 @@ module EffectiveLogging
86
86
  (resource.class.try(:reflect_on_all_autosave_associations) || []).each do |association|
87
87
  attributes[association.name] = {}
88
88
 
89
- resource.send(association.name).each_with_index do |child, index|
89
+ Array(resource.send(association.name)).each_with_index do |child, index|
90
90
  attributes[association.name][index+1] = ActiveRecordLogger.new(child, options.merge(logger: logger)).attributes
91
91
  end
92
92
  end
@@ -125,7 +125,7 @@ module EffectiveLogging
125
125
  elsif options[:except].present?
126
126
  attributes.except(*options[:except])
127
127
  else
128
- attributes
128
+ attributes.except(:updated_at, :created_at)
129
129
  end
130
130
 
131
131
  (options[:additionally] || []).each do |attribute|
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '1.5.8'.freeze
2
+ VERSION = '1.5.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails