recourse 7.1.0 → 7.2.1

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: b5902f16def7afce17cc0aec2d67eb1255ffc504af58cbd766146a4f3e7f3077
4
+ data.tar.gz: 3e917516c8a76bdc0fe30497e02d7181a886d96f500cd765dfbe6202f4785452
5
5
  SHA512:
6
- metadata.gz: f87b1572b17070744c3c03c2f64b6d699e53a738270b4bf2d88f0040264992a050709e891fde967e2c21f64508e41191a56cab0ba3b7e3dda1fa04bb3b25f9dd
7
- data.tar.gz: bcf92ebc75b14486038c81b558580ff958e49d28a17259d895a97888e5a350dd3afe610f72b959b343a9a47b9c41a09b203518b1f28532d61fada8df683b5f2c
6
+ metadata.gz: d1a6d35fa1bd005290644f5f8981ac7a7837fda2f6bb9919b3225518ab41bacdf497d261827116b43928b1cf1f918eea3b5030de38faed3bd195aa257db6f798
7
+ data.tar.gz: e242d7c656755f01f53c1e2f3c1f9b75c89bbc5654b50a3dc44e6bb7f768c64321572c024e7d52fe036dcfc9c65bed2eaee7464815617e2294bfcbecc64350dc
data/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 7.2.1 - 2026-09-20
11
+
12
+ * [FIX] A refused change keeps the card it was made in
13
+
14
+ The card is drawn around a record's own pages, worked out from the action: `show` and
15
+ `edit`. A write a validation turns down draws `edit` again under the name `update`, so
16
+ the tabs went with it and the reader was left with a form and no way back.
17
+
18
+ ## 7.2.0 - 2026-09-20
19
+
20
+ * [CHANGE] A row a model will not give up says so, rather than raising
21
+
22
+ `destroy` was `destroy!`, so a `before_destroy` that threw `:abort` answered a reader
23
+ with a 500. The page keeps the row and says `Specialty could not be deleted.`, the way
24
+ an update that a validation turned down says what it says.
25
+
10
26
  ## 7.1.0 - 2026-09-20
11
27
 
12
28
  * [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:
@@ -3,13 +3,18 @@ module Recourse
3
3
  # The tabs on the card a record's pages share: a look, a change, and each
4
4
  # nested index under the record — counted where the record keeps a count.
5
5
  module Cards
6
+ # The pages a record's card is drawn around. `update` is the change page too: a
7
+ # write a validation turns down draws the form again, and the tabs a reader came
8
+ # in by are still the record's.
9
+ CARDED = %w[show edit update].freeze
10
+
6
11
  private
7
12
 
8
13
  # The record whose card this page is drawn in: the parent, on a page nested under
9
14
  # one, and the record itself where the page is its look or its change. An index of
10
15
  # its own, and a form for a record that is not there yet, stand outside a card.
11
16
  def card_record
12
- resource_parent || (resource_record if controller.action_name.in? %w[show edit])
17
+ resource_parent || (resource_record if controller.action_name.in? CARDED)
13
18
  end
14
19
 
15
20
  # The pages of the record the card is about, as `[label, path, current]` — a
@@ -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.1'
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob