motor-admin 0.1.36 → 0.1.37

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
  SHA256:
3
- metadata.gz: 8e0174dc9b889d34d1cff62947e5f330d04c37a8eea6a1036b88a5735edc3b9c
4
- data.tar.gz: 84136e87872e4bd988055090e602e831f85516286f4dc39b9c15cd635feb5c03
3
+ metadata.gz: c003af4059ae5bd3a60d30031526c1ed2aefd267c7e1f93f33e5bac94eaff5c7
4
+ data.tar.gz: aa7403bca65f0d936b86bcc58f1fe88b4081439d74843f1ca1c3d25fd4da8a81
5
5
  SHA512:
6
- metadata.gz: 8d637a2d8b014e7c57c6e77b92c9c62c96ccb3a6201173e455122ab1c9f0d0cfe5070380712ce5618bf9975a225d5622336bd4e16ed1f33d689d9f340dcaf9e4
7
- data.tar.gz: 241c173529982aa8403691eb0818f8cf5357a61ae1b7820caca288a7d91faf9f1aa00485c1a716df266777de9bac37b2da36700ed04d0463b98f05299dff8cb9
6
+ metadata.gz: a195dd04aceadc74e1d7fa89dc0100c15fc045c0fad238230567069801698d341d6a9e598b861ae9e802e61dd5a48915d15c74b88a1228deae5a985fad283762
7
+ data.tar.gz: 7d6dc23a2750dc941b20d83170dc3f2eb3018d02897b2500b99831285ac139fcde46ebfa7ae044be856504bac6f09e1d11e70c02a443eba6d70278b959784f74
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Alert < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  belongs_to :query
8
8
  belongs_to :author, polymorphic: true, optional: true
@@ -4,5 +4,15 @@ module Motor
4
4
  class ApplicationRecord < ActiveRecord::Base
5
5
  self.abstract_class = true
6
6
  self.table_name_prefix = 'motor_'
7
+
8
+ def self.audited(*args)
9
+ default_class = Audited.audit_class
10
+
11
+ Audited.audit_class = Motor::Audit
12
+
13
+ super
14
+ ensure
15
+ Audited.audit_class = default_class
16
+ end
7
17
  end
8
18
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Config < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  serialize :value, HashSerializer
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Dashboard < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  belongs_to :author, polymorphic: true, optional: true
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Form < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  belongs_to :author, polymorphic: true, optional: true
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Query < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  belongs_to :author, polymorphic: true, optional: true
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Motor
4
4
  class Resource < ::Motor::ApplicationRecord
5
- AuditedUtils.with_audit_class(Motor::Audit) { audited }
5
+ audited
6
6
 
7
7
  serialize :preferences, HashSerializer
8
8
  end
@@ -138,9 +138,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
138
138
  t.column :created_at, :datetime
139
139
  end
140
140
 
141
- add_index :motor_audits, %i[auditable_type auditable_id version], name: 'auditable_index'
142
- add_index :motor_audits, %i[associated_type associated_id], name: 'associated_index'
143
- add_index :motor_audits, %i[user_id user_type], name: 'user_index'
141
+ add_index :motor_audits, %i[auditable_type auditable_id version], name: 'motor_auditable_index'
142
+ add_index :motor_audits, %i[associated_type associated_id], name: 'motor_auditable_associated_index'
143
+ add_index :motor_audits, %i[user_id user_type], name: 'motor_auditable_user_index'
144
144
  add_index :motor_audits, :request_uuid
145
145
  add_index :motor_audits, :created_at
146
146
  end
data/lib/motor.rb CHANGED
@@ -46,7 +46,6 @@ end
46
46
 
47
47
  require 'motor/version'
48
48
  require 'motor/admin'
49
- require 'motor/audited_utils'
50
49
  require 'motor/assets'
51
50
  require 'motor/build_schema'
52
51
  require 'motor/api_query'
@@ -13,7 +13,7 @@ module Motor
13
13
  arel_order = build_arel_order(rel.klass, param)
14
14
  join_params = build_join_params(rel.klass, param)
15
15
 
16
- rel.order(arel_order).left_joins(join_params)
16
+ rel.reorder(arel_order).left_joins(join_params)
17
17
  end
18
18
 
19
19
  def build_join_params(_model, param)
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.1.36'
4
+ VERSION = '0.1.37'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.36
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
@@ -209,7 +209,6 @@ files:
209
209
  - lib/motor/api_query/search.rb
210
210
  - lib/motor/api_query/sort.rb
211
211
  - lib/motor/assets.rb
212
- - lib/motor/audited_utils.rb
213
212
  - lib/motor/build_schema.rb
214
213
  - lib/motor/build_schema/active_storage_attachment_schema.rb
215
214
  - lib/motor/build_schema/find_display_column.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AuditedUtils
4
- module_function
5
-
6
- def with_audit_class(new_class)
7
- old_class = Audited.audit_class
8
-
9
- Audited.audit_class = new_class
10
-
11
- yield
12
- ensure
13
- Audited.audit_class = old_class
14
- end
15
- end