recourse 7.1.0 → 7.2.0

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: 80390029ce0bfed87fcf8247faceb992a392422044f0b0641bbfadb9bd3660f0
4
- data.tar.gz: 81f226e7f69b2fa9846e2bc80e610d227e182d680b8c1d563b095a26f26fee1c
3
+ metadata.gz: 95ef379a34df3d662d855df04690b3627584af8e5340d3bc7f9fd451569d6828
4
+ data.tar.gz: 6429eefa62d743af7e1071cac2bed85618fc36dba623551d14d01f62129b2ded
5
5
  SHA512:
6
- metadata.gz: f87b1572b17070744c3c03c2f64b6d699e53a738270b4bf2d88f0040264992a050709e891fde967e2c21f64508e41191a56cab0ba3b7e3dda1fa04bb3b25f9dd
7
- data.tar.gz: bcf92ebc75b14486038c81b558580ff958e49d28a17259d895a97888e5a350dd3afe610f72b959b343a9a47b9c41a09b203518b1f28532d61fada8df683b5f2c
6
+ metadata.gz: 487d50ea3bf02897f91807512d4624dd768b41483ccd5b4a4da74f4d3aa8e460c3491e3abe1739d13ca55480a985b9c93485112352c28bae5729c0969316f92b
7
+ data.tar.gz: 29540aff5c10c30fca2a7c79ac0fe6ad4f572d505be2a085dfc7f3675539941c0a67358a328a431a0d39974410665a5e7891c3511e88b93cb26926ba916d707e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 7.2.0 - 2026-09-20
11
+
12
+ * [CHANGE] A row a model will not give up says so, rather than raising
13
+
14
+ `destroy` was `destroy!`, so a `before_destroy` that threw `:abort` answered a reader
15
+ with a 500. The page keeps the row and says `Specialty could not be deleted.`, the way
16
+ an update that a validation turned down says what it says.
17
+
10
18
  ## 7.1.0 - 2026-09-20
11
19
 
12
20
  * [CHANGE] The card draws the button that deletes what the page is about
@@ -23,7 +23,7 @@ module Recourse
23
23
  def destroy_resource(record)
24
24
  return super unless attachment_reflection
25
25
 
26
- attachment_of(record).destroy!
26
+ attachment_of(record).destroy
27
27
  end
28
28
 
29
29
  # Attached rather than assigned, which is the whole reason this exists. Rails'
@@ -24,7 +24,7 @@ module Recourse
24
24
 
25
25
  # And the record gone. `destroy!`, so a callback that stops one says so rather than
26
26
  # leaving the page claiming it worked.
27
- def destroy_resource(record) = record.destroy!
27
+ def destroy_resource(record) = record.destroy
28
28
 
29
29
  # A foreign key whose label is typed arrives as that label, so it is looked up
30
30
  # here. Nothing found leaves the key nil, and `belongs_to` reports it missing.
@@ -65,11 +65,14 @@ module Recourse
65
65
  end
66
66
  end
67
67
 
68
- # Deletes the record and shows the index without it. `destroy!`, so a callback that
69
- # stops one says so rather than leaving the page claiming it worked.
68
+ # Deletes the record and shows the index without it. A callback that stops one is
69
+ # answered where the record still is, rather than left to raise or to let the page
70
+ # claim it worked: a row a model refuses to give up is a page's business, not a 500.
70
71
  def destroy
71
- destroy_resource @recourse
72
- wrote t('recourse.deleted', model: human_name)
72
+ return wrote t('recourse.deleted', model: human_name) if destroy_resource @recourse
73
+
74
+ flash.alert = t('recourse.deleted_error', model: human_name)
75
+ redirect_back fallback_location: url_for(action: :index), status: :see_other
73
76
  end
74
77
 
75
78
  private
@@ -50,6 +50,7 @@ en:
50
50
  darken: Dark
51
51
  delete: Delete %{model}
52
52
  deleted: "%{model} was deleted."
53
+ deleted_error: "%{model} could not be deleted."
53
54
  destroy: Delete
54
55
  exit: Exit
55
56
  displaying:
@@ -1,4 +1,4 @@
1
1
  module Recourse
2
2
  # Version of the gem, read by the gemspec and by hosts checking compatibility.
3
- VERSION = '7.1.0'
3
+ VERSION = '7.2.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob