effective_resources 2.19.8 → 2.19.9

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
  SHA256:
3
- metadata.gz: e07e4841376e727004fa9089f33c259e564acc03061b485eca87ede10ff42fd1
4
- data.tar.gz: ea0a6fc7a9babf63988157f30893cefb186ea20d04d009b233b7c1269aed2591
3
+ metadata.gz: a64aa8daa41dc12a1702ee128d8a972ec46a005f616f2091f9821075c817f9c7
4
+ data.tar.gz: c59a857b8b39855a74bfda837b59c259d92b192081c9af65947ad22de202d074
5
5
  SHA512:
6
- metadata.gz: 409ac230ffdcae4195e61f1a969b7a2b945305fbeca00b9f18848750c80dc51469fcb638a2ebfc74d4c07d59216893a599891fec8aa8d643ea5bf3770f146446
7
- data.tar.gz: 906f2e460fc11e521b9ba8338eab206ae66784c1baa3c37fd3f8bff66ba0866b08ef3377e9e696b070770e7366e507e6bc59fdcb0e61b1b0cd93fc5bdab562d5
6
+ metadata.gz: 71b49bf9d7152eeee999e1fffec4020355274f140c6c6e3bc4757cc8c69716808816bff5bf96b8332028ddedbf8ef24633616ea827118154bd7935aa0804a83a
7
+ data.tar.gz: 1ff8ec49ce929e048e9582134447046c03448c7d0a2d0fb794c6024e83a03d705a9193a63336bd6fd7d4b0e64f1e08e44ceb2f54de281c175f3de0cb344170ac
@@ -72,10 +72,22 @@ module Effective
72
72
  def referer_redirect_path
73
73
  url = request.referer.to_s
74
74
 
75
- return if (resource && resource.respond_to?(:destroyed?) && resource.destroyed? && url.include?("/#{resource.to_param}"))
75
+ # Referer may not always be present
76
+ return if url.blank?
77
+
78
+ # Don't redirect back to this resource's show or edit page
79
+ if resource.try(:destroyed?)
80
+ to_param = (resource.to_param || resource.try(:token) || resource.try(:slug) || resource.id) # to_param is nil sometimes
81
+ return if to_param.present? && url.include?("/#{to_param}")
82
+ end
83
+
84
+ # Don't redirect back if we're on duplicate action
76
85
  return if url.include?('duplicate_id=')
77
- return unless (Rails.application.routes.recognize_path(URI(url).path) rescue false)
78
86
 
87
+ # Don't redirect unless we recognize the url
88
+ return unless (Rails.application.routes.recognize_path(url) rescue false) || (Rails.application.routes.recognize_path(URI(url).path) rescue false)
89
+
90
+ # Redirect to this recognized url
79
91
  url
80
92
  end
81
93
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.8'.freeze
2
+ VERSION = '2.19.9'.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.19.8
4
+ version: 2.19.9
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: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.4.10
291
+ rubygems_version: 3.5.6
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Make any controller an effective resource controller.