thoth 0.0.7 → 1.0.0

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: a65775a29690b9a11318adea865cc4351e5cf63f
4
- data.tar.gz: d24d2ff4961996e528040ac90518cbf0d986afa7
3
+ metadata.gz: 783958368567ca3b8bc49e08d8eaa7915d877278
4
+ data.tar.gz: fb19913e717e4a4ef9f3f180f4f1778b09f68d26
5
5
  SHA512:
6
- metadata.gz: a884fa11c29399ad01e1e3cdcc82a65094d8e34802819f44b25da295f05b7044887c96ea37f514695f319bb80b7388a2964bfc1e62b5daedac17402bafb1c750
7
- data.tar.gz: 2f80b4be156db2ac6dae26b8591333185aefb03d12b2777515df34a8f2a3ae996947d4d5c80dff0aaaefa1e988b1432f794dde7266b70d5530b5a58f509a247d
6
+ metadata.gz: 291f647ab726eeb4f9b61fda95bd0ee0bb6711653e2c94e5b4f7c1afb04cb85abf2c19f789c90cddee1f908c8015f9862e646f1a1233426b03f41d657683f0f4
7
+ data.tar.gz: 7ce57e9ed66dcdce7056bb014f0c782d99eaf820f05650de197023c890f8ca359ed889d1bed0bcaf2d78dc94d05360d7e209fec959437bb723834d786ced8d63
data/README.md CHANGED
@@ -42,6 +42,7 @@ class Cat < ActiveRecord::Base
42
42
 
43
43
  # :on (default [:create, :update, :destroy]) - which events should be logged
44
44
  # :only (default all attributes) - for updates, only log when these attributes are changed
45
+ # :except (default none) - for updates, do not log if only attributes in this list are changed
45
46
  log_events on: [:update, :destroy], only: [:mood, :name]
46
47
  end
47
48
  ```
@@ -3,7 +3,7 @@ module Thoth
3
3
  module ControllerContext
4
4
 
5
5
  def self.included(base)
6
- base.around_filter(:set_thoth_request_context)
6
+ base.around_action(:set_thoth_request_context)
7
7
  end
8
8
 
9
9
  def set_thoth_request_context
@@ -30,7 +30,13 @@ module Thoth
30
30
  def thoth_log_update
31
31
  return unless self.class.thoth_options[:on].include?(:update)
32
32
 
33
- only_options = self.class.thoth_options[:only]
33
+ if except_options.present?
34
+ except_options = self.class.thoth_options[:except]
35
+ only_options = self.class.columns.map(&:name) - except_options
36
+ else
37
+ only_options = self.class.thoth_options[:only]
38
+ end
39
+
34
40
  if only_options.empty? || !(only_options.map(&:to_s) & changes.keys).empty?
35
41
  thoth_log_model(:update)
36
42
  end
data/lib/thoth/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Thoth
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philippe Huibonhoa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2017-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport