thecore_backend_commons 3.0.9 → 3.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02e0dc0a4db400d2e673834351ca1e026b57404bc065277084520156a0ee7929
|
4
|
+
data.tar.gz: ab4b18f01d368505765cc48581e502ae348693fe8a8818f62fc7f4016611c4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0056a8bd4b9a0d4912f835c64f571e90071f5f1eabd9d336cfcbab2c1459748d8e2ff13f14bd6eb24aa89c4644dc33c54339226e87dbfebe4226df359a92749a
|
7
|
+
data.tar.gz: 9a8d6d01ca0a2b679da6a586f23379fdcc6db490f3a1fa1d87c51bbe332018699e8441f2df67fba6774a7fc5186542bf88dfe800e393a85185769db115bb7c32
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module ApplicationRecordConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
after_validation :validation_ko
|
7
|
+
|
8
|
+
after_commit :message_ok
|
9
|
+
|
10
|
+
after_rollback :message_ko
|
11
|
+
|
12
|
+
def validation_ko
|
13
|
+
ActionCable.server.broadcast("messages", { topic: :record, action: detect_action, success: false, valid: false, errors: self.errors.full_messages, record: self}) if self.errors.any?
|
14
|
+
end
|
15
|
+
|
16
|
+
def message_ok
|
17
|
+
ActionCable.server.broadcast("messages", { topic: :record, action: detect_action, success: true, valid: true, errors: [], record: self})
|
18
|
+
end
|
19
|
+
|
20
|
+
def message_ko
|
21
|
+
ActionCable.server.broadcast("messages", { topic: :record, action: detect_action, success: false, valid: true, errors: [], record: self})
|
22
|
+
end
|
23
|
+
|
24
|
+
def detect_action
|
25
|
+
return :create if transaction_include_any_action?([:create])
|
26
|
+
return :update if transaction_include_any_action?([:update])
|
27
|
+
:destroy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_backend_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_auth_commons
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- config/initializers/add_to_db_migrations.rb
|
152
152
|
- config/initializers/after_initialize.rb
|
153
153
|
- config/initializers/application_config.rb
|
154
|
+
- config/initializers/concern_application_record.rb
|
154
155
|
- config/initializers/concern_cable_connection.rb
|
155
156
|
- config/initializers/concern_integer.rb
|
156
157
|
- config/initializers/concern_string.rb
|