active_versioning_workflow 1.1.0 → 1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ced0b0d18cb1bc35a477b808883c53f4e473cb18
|
4
|
+
data.tar.gz: 89eb70d1f5cbc833ca3c80069a79e7a3793bab5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8869a54941ea4ae18a0280de46e82a81bb4d733de33641911f1ef84d5eb59cb287296bccfe4dbf9ce5afa244be6d1590c3d8beffcada9b7666302e73417377a3
|
7
|
+
data.tar.gz: 5ec0b730623543608bd3616ca2cb6a78d76a8c139b993e1ed644bc3da97c4c90d33b609e58377209f5957526d16a6a342385e34cce563111749fdffb59bbc818
|
@@ -9,14 +9,22 @@ module ActiveVersioning
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def preview_path_for(resource, options = {})
|
12
|
-
|
12
|
+
path = if resource.respond_to? :path
|
13
|
+
resource.path(_preview: true)
|
14
|
+
end
|
15
|
+
|
16
|
+
path.presence || preview_path_proc.call(resource, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def preview_path_proc
|
22
|
+
proc do |resource, options|
|
13
23
|
param = resource.try(:slug) || resource.to_param
|
14
24
|
route_key = resource.model_name.singular_route_key
|
15
25
|
|
16
26
|
options.fetch(:context, self).send("#{route_key}_path", param, _preview: true)
|
17
27
|
end
|
18
|
-
|
19
|
-
resource.try(:path, _preview: true) || resource_path.call(resource)
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|