effective_resources 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fdcf01c69458d8e030d019b71b8f56dba8ed6eae878c626125baca1c798fc87
|
4
|
+
data.tar.gz: 23c9425e10027572f282e93bde82e077e55aaf291600a64ee307beae3e7acd9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f2ff6adccdbbb14d23b4d3bd19ddb6ecd08726468d55f9a414477e920c16549a153d97d06cc015809e337f5d25be9b0ee39cd60ade94229d61382391fec22f
|
7
|
+
data.tar.gz: b66e45de9d79cc0332b4e33a91ca26666cf087617c7204796a90a1b5bdeee2e27baecf4e8188441de7db35b6b8a53ca8ceca8e72bcdd8b8ceab68674a026404a
|
@@ -8,6 +8,12 @@ module Admin
|
|
8
8
|
def users
|
9
9
|
collection = current_user.class.all
|
10
10
|
|
11
|
+
if collection.respond_to?(:to_select2)
|
12
|
+
collection = collection.to_select2
|
13
|
+
elsif collection.respond_to?(:sorted)
|
14
|
+
collection = collection.sorted
|
15
|
+
end
|
16
|
+
|
11
17
|
respond_with_select2_ajax(collection) do |user|
|
12
18
|
{ id: user.to_param, text: user.try(:to_select2) || to_select2(user) }
|
13
19
|
end
|
@@ -16,7 +22,7 @@ module Admin
|
|
16
22
|
private
|
17
23
|
|
18
24
|
def to_select2(user)
|
19
|
-
"<span>#{user
|
25
|
+
"<span>#{user}</span> <small>#{user.email}</small>"
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
@@ -49,8 +49,11 @@ module Effective
|
|
49
49
|
exception = e # Dont rollback
|
50
50
|
end
|
51
51
|
end
|
52
|
+
rescue ActiveRecord::RecordInvalid => e
|
53
|
+
exception = e
|
52
54
|
rescue => e
|
53
55
|
exception = e
|
56
|
+
notify_exception(e, resource, action) unless e.class.name == 'RuntimeError'
|
54
57
|
end
|
55
58
|
|
56
59
|
if exception.present?
|
@@ -74,6 +77,14 @@ module Effective
|
|
74
77
|
success
|
75
78
|
end
|
76
79
|
|
80
|
+
def notify_exception(exception, resource, action)
|
81
|
+
if defined?(ExceptionNotifier)
|
82
|
+
ExceptionNotifier.notify_exception(exception, env: request.env, data: { resource: resource, action: action })
|
83
|
+
else
|
84
|
+
raise(exception)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
77
88
|
def resource_flash(status, resource, action, e: nil)
|
78
89
|
submit = commit_action(action)
|
79
90
|
message = submit[status].respond_to?(:call) ? instance_exec(&submit[status]) : submit[status]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
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: 2022-10-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|