effective_resources 0.8.11 → 0.8.12
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9f3c476a1b25d899e3ef80460fd11bf5738949
|
4
|
+
data.tar.gz: bff4db8bfebd28a8b194e390837a2509aff6f9fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 036821b4210acece00173e2c1afd0aa406a11359b50b91f1d6eae3b1be4da035cdfacd104b5e8a8a2608a6aed8df1a3257b0991a16f01fd086fcf6df3f6921a6
|
7
|
+
data.tar.gz: 5b208d0903fc51e37e3236c40a22a06d4938e4679d3131dede7b7df358754072e54fc3b9abb429677ee2ff56c8de36688b94e99477dd8d23167310414cbca8b1
|
@@ -30,6 +30,7 @@ module ActsAsTokened
|
|
30
30
|
def find(*args)
|
31
31
|
return super unless args.length == 1
|
32
32
|
return super if block_given?
|
33
|
+
return find_by_id(args.first) if @_effective_reloading
|
33
34
|
|
34
35
|
find_by_token(args.first) || raise(::ActiveRecord::RecordNotFound.new("Couldn't find #{name} with 'token'=#{args.first}"))
|
35
36
|
end
|
@@ -40,5 +41,16 @@ module ActsAsTokened
|
|
40
41
|
token
|
41
42
|
end
|
42
43
|
|
44
|
+
def to_global_id(**params)
|
45
|
+
GlobalID.new(URI::GID.build(app: Rails.application.config.global_id.app, model_name: model_name, model_id: to_param, params: params))
|
46
|
+
end
|
47
|
+
|
48
|
+
def reload(options = nil)
|
49
|
+
self.class.instance_variable_set(:@_effective_reloading, true)
|
50
|
+
retval = super
|
51
|
+
self.class.instance_variable_set(:@_effective_reloading, nil)
|
52
|
+
retval
|
53
|
+
end
|
54
|
+
|
43
55
|
end
|
44
56
|
|
@@ -49,7 +49,10 @@ module Effective
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
# This generates the correct route when an object is overriding to_param
|
53
|
+
formattable = (resource || instance).attributes.symbolize_keys.merge(id: (resource || instance).to_param)
|
54
|
+
|
55
|
+
path = routes[action].format(formattable).presence
|
53
56
|
|
54
57
|
if path.present? && opts.present?
|
55
58
|
uri = URI.parse(path)
|
@@ -118,7 +121,6 @@ module Effective
|
|
118
121
|
def is_post_route?(route)
|
119
122
|
['POST', 'PUT', 'PATCH'].any? { |verb| route.verb == verb }
|
120
123
|
end
|
121
|
-
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|