effective_resources 2.1.3 → 2.1.4
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 +4 -4
- data/app/models/concerns/acts_as_slugged.rb +19 -1
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c6a9d06e7d62a4fa96c365b8e6386d4229585ed5c0963b3f55b435ed4b7cbf4
|
4
|
+
data.tar.gz: 84459f1187673d432756a4e3fccf6b163f3b5f55af26a7c1c485938e892d9e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76ef089d1b702f51948cf5ec7b03fc8fe9529428190225b9e27bddbc91c83c3e8d9b01911a2ae5d97efcae22cd8e2f77dd0d642b32b5184b459a6ccb4e3bbfa
|
7
|
+
data.tar.gz: 6e13de73624c865c3312d2af94816890769599ed2aa1d89e4cde5251d545d25583a14293b04d2a152cc493c2c6c222015cba326e09dec19310771668bda2b8ab
|
@@ -40,7 +40,13 @@ module ActsAsSlugged
|
|
40
40
|
return super unless args.length == 1
|
41
41
|
return super if block_given?
|
42
42
|
|
43
|
-
|
43
|
+
reloading = instance_variable_get(:@_effective_reloading)
|
44
|
+
reloading ||= self.class.instance_variable_get(:@_effective_reloading)
|
45
|
+
reloading ||= klass.instance_variable_get(:@_effective_reloading) if respond_to?(:klass)
|
46
|
+
|
47
|
+
return find_by_id(args.first) if reloading
|
48
|
+
|
49
|
+
find_by_slug(args.first) || raise(::ActiveRecord::RecordNotFound.new("Couldn't find #{name} with 'slug'=#{args.first}"))
|
44
50
|
end
|
45
51
|
|
46
52
|
def find_by_slug_or_id(*args)
|
@@ -68,4 +74,16 @@ module ActsAsSlugged
|
|
68
74
|
slug_was || slug
|
69
75
|
end
|
70
76
|
|
77
|
+
def to_global_id(**params)
|
78
|
+
params[:tenant] = Tenant.current if defined?(Tenant)
|
79
|
+
GlobalID.new(URI::GID.build(app: Rails.application.config.global_id.app, model_name: model_name, model_id: to_param, params: params))
|
80
|
+
end
|
81
|
+
|
82
|
+
def reload(options = nil)
|
83
|
+
self.class.instance_variable_set(:@_effective_reloading, true)
|
84
|
+
retval = super
|
85
|
+
self.class.instance_variable_set(:@_effective_reloading, nil)
|
86
|
+
retval
|
87
|
+
end
|
88
|
+
|
71
89
|
end
|
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.1.
|
4
|
+
version: 2.1.4
|
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-11-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|