models_auditor 1.0.2 → 1.0.3

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: a248c7be6e7791226e4e3dfdd025ebf1f0951628
4
- data.tar.gz: 6db62e95de615c9d464a7cc3079081a7a757f217
3
+ metadata.gz: f957de6a2eb5bf5af17bc1feb21f59bc45401e46
4
+ data.tar.gz: 2449ae7454012b6f71e3077ca670cf896d5f8074
5
5
  SHA512:
6
- metadata.gz: d5c3749a62ded4d9e41049e4a49651c3dae14408bda99a078f8acf40574847e8dddb1856a67286147b6cd57db566e05547e21924f505a53945f3012f2b9cefdc
7
- data.tar.gz: 01b11969cb4d8f346683a94dba8055a034e2e4cfa3be221322faa78fd82fd23b6fffc54c1e7c2b693f783b4db31eeb7a8ba1f124c6a5d8459f72d72d8e8378b3
6
+ metadata.gz: 364710a534832e487b1d3936fc18e6950ad6b0788a85850dee375fd5ac6b184596b2c2d6b5cfc67aaa0ac7b327a7007022fa8fe6da034ef06c57507b0c27da4f
7
+ data.tar.gz: 5f09730b6c5394ff3e53d056ceacfc8fe67c9deb1715be787dc82604aa42befd76884c34b3edbc42ba201bb2bd20326b9e8445e328b408e4b758161bb9de3d87
@@ -3,8 +3,12 @@ module ModelsAuditor
3
3
  ACTION_CREATE = 0
4
4
  ACTION_UPDATE = 1
5
5
  ACTION_DESTROY = 2
6
+ begin
7
+ establish_connection [ModelsAuditor.config.connection_namespace, Rails.env].map(&:presence).compact.join('_').to_sym
8
+ rescue StandardError
9
+ # ignored
10
+ end
6
11
 
7
- establish_connection [ModelsAuditor.config.connection_namespace, Rails.env].map(&:presence).compact.join('_').to_sym
8
12
  self.table_name = ModelsAuditor.config.audit_records_table_name
9
13
 
10
14
  belongs_to :request, class_name: ModelsAuditor::AuditRequest.name, foreign_key: :request_id
@@ -1,6 +1,10 @@
1
1
  module ModelsAuditor
2
2
  class AuditRequest < ActiveRecord::Base
3
- establish_connection [ModelsAuditor.config.connection_namespace, Rails.env].map(&:presence).compact.join('_').to_sym
3
+ begin
4
+ establish_connection [ModelsAuditor.config.connection_namespace, Rails.env].map(&:presence).compact.join('_').to_sym
5
+ rescue StandardError
6
+ # ignored
7
+ end
4
8
  self.table_name = ModelsAuditor.config.audit_requests_table_name
5
9
 
6
10
  has_many :records, class_name: ModelsAuditor::AuditRecord.name, foreign_key: :request_id, inverse_of: :request
@@ -90,8 +90,7 @@ module ModelsAuditor
90
90
  ModelsAuditor.log_error(e.message)
91
91
  ModelsAuditor.log_error(e.backtrace.take(100).join("\n"))
92
92
  end
93
- # TODO To remove the #join call from the thread block after debugging
94
- end.join
93
+ end
95
94
  end
96
95
 
97
96
  private
@@ -24,7 +24,7 @@ module ModelsAuditor
24
24
  def default
25
25
  @default ||= {
26
26
  audit_enabled: {
27
- config: 'true',
27
+ config: '%w(staging production).include?(Rails.env)',
28
28
  val: true
29
29
  },
30
30
  connection_namespace: {
@@ -12,6 +12,8 @@ module ModelsAuditor
12
12
  user_id: user_for_models_auditor,
13
13
  request_info: info_for_models_auditor
14
14
  )
15
+ rescue StandardError
16
+ # ignored
15
17
  end
16
18
 
17
19
  # Returns the user who is responsible for any changes that occur.
@@ -1,3 +1,3 @@
1
1
  module ModelsAuditor
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: models_auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Gorbunov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-06 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails