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: faea94025b06a679c6073bc2eed8677ef498c5ed
4
- data.tar.gz: df408b6ccfbda2d62d893908218abae42f3a9913
3
+ metadata.gz: ced0b0d18cb1bc35a477b808883c53f4e473cb18
4
+ data.tar.gz: 89eb70d1f5cbc833ca3c80069a79e7a3793bab5b
5
5
  SHA512:
6
- metadata.gz: 70c31eea328365bd8991b110e32d01016e167d733da322b6302ab37b15332d19a417be4fe22630681696f85d932e3ab5c3562544a65233a5e44eeea4a4db7a64
7
- data.tar.gz: 993dde8dae50274d1a4d703d28e2c5b88e0e12def10eb574eceeb2da5b985f3da834a287a7c62ff1bacbdd84d69161b5453fc07ddb6457b9ea1411d4dfe95e5d
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
- resource_path = proc do |resource|
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
@@ -1,5 +1,5 @@
1
1
  module ActiveVersioning
2
2
  module Workflow
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_versioning_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stenberg