effective_resources 2.8.4 → 2.8.5

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: 13d2181e7cf9ab5d68d9b25302761489380f890e0c9046e545a5c2fcb854be0b
4
- data.tar.gz: e4639dbcdb1cd89cebe4c0a196c5cf973b089b35cf24261a3c1ea70854fb5c59
3
+ metadata.gz: 40f7d69324aa9033e2ae26f51dda5216126ce457aa774cf4910ac46e7fae1c64
4
+ data.tar.gz: c451889a8ba4bdf4e3d2ad6f50ccce98c71f7c3e365784ee34d55e69d3edcd09
5
5
  SHA512:
6
- metadata.gz: e2ee62822958ebf3be1872c0926c10cae4ffa140aab91e9201b4dc781222f6ee8f92f8bf0269209296c6dc334f49fc13582e6f71e7d42f3ae081059fa3c5bd2d
7
- data.tar.gz: 55894ca40b3e35d3ac800715bf9c906af9253cc3bad75b5a8a4bb01b2cb9b36b5e2d1f9a74818ac9ccfd72a70305f64c7f94a519afd66a21a6184e0d6a5d1679
6
+ metadata.gz: d47e10d57c5cedd1f4d4e0518e3d98d4e859fff20a20d92392472065c0cc00e1719a872416a1e39f140a0ef29034d2bf46d3cfab7a6d8f374d961ee78c5c083b
7
+ data.tar.gz: 53f334f1df12747419b47d8e30467b311bf997d2a8ff08d0a7ca71d0feda8b1c2ba0dc824727671fa9f811c27c1e7131c48fb7102109cf892550a9540e944631
@@ -30,8 +30,12 @@ module Effective
30
30
  end
31
31
 
32
32
  # Duplicate if possible
33
- if params[:duplicate_id]
34
- duplicate = resource_scope.find_by_id(params[:duplicate_id]) || resource_scope.find(params[:duplicate_id])
33
+ if params[:duplicate_id].present?
34
+ duplicate = (resource_scope.find(params[:duplicate_id]) rescue nil)
35
+ duplicate ||= (resource_scope.find_by_id(params[:duplicate_id]) rescue nil)
36
+
37
+ raise ActiveRecord::RecordNotFound unless duplicate.present?
38
+
35
39
  EffectiveResources.authorize!(self, :show, duplicate)
36
40
 
37
41
  self.resource = duplicate_resource(duplicate)
@@ -7,8 +7,8 @@
7
7
  #
8
8
  # class Thing < ApplicationRecord
9
9
  # has_many :comments
10
- # acts_as_archivable cascade: :comments
11
- # acts_as_archivable cascade: :comments, strategy: :archive|:archive_all|:active_job
10
+ # acts_as_archived cascade: :comments
11
+ # acts_as_archived cascade: :comments, strategy: :archive|:archive_all|:active_job
12
12
  # end
13
13
 
14
14
  # Each controller needs its own archive and unarchive action.
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.8.4'.freeze
2
+ VERSION = '2.8.5'.freeze
3
3
  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.8.4
4
+ version: 2.8.5
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: 2023-06-26 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails