recourse 7.11.2 → 8.0.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: 96bb337b5a0517cc5f7715b898c0cffd01c33fc6b8e7a6750f939b7361879fd4
4
- data.tar.gz: e77f1f0f2f4a42955669e988302bff0df520aa98a8cb7ce0d171cda7e7bd85ea
3
+ metadata.gz: 9fa259fe4854972da8f5269d6d63c00851e061bd0cd6d490db9caa31ca38be22
4
+ data.tar.gz: 6671b757de11387812c82d201476e65389110398fce8d1f3afe7dce1f1fd46a2
5
5
  SHA512:
6
- metadata.gz: 9d203812049cdcd045323970939f23c4aeb825e5cd904b949e511b8700bd24781ae5cb36ef83c41b7e90547665a5c255c00c4158425a3c7a1c04b86d9182a223
7
- data.tar.gz: 17c113285f5c356e86fad57838069d9c42b8c272d19950649be5f992a674de2bf1b1e6a60e75be220ec77ea48e15462459127cb94b7ba6ffffe5a2c9372576da
6
+ metadata.gz: 004ce92287a95a326b937a33ee04737753546d46eae1f6dbcb2cb2a41480e1f8e3caca92f2f18fb5dfb9f2a76d9face21adfc4e00443ae1e2a354e74d76d2b20
7
+ data.tar.gz: ca43947c8aae99999a3f0332d737e31d229f6f0934315fddf7393e39650c13e5e9e4681a1cba4219e6cb9f683a363cbe6caea8e3c253b0ee2be3c50969b01655
data/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 8.0.0 - 2026-10-14
11
+
12
+ * [BREAKING] A record's own pages find it among the rows `recourse_relation` lists
13
+
14
+ `show`, `edit`, `update` and `destroy` looked a record up by id across the whole model,
15
+ so a host that narrowed its table -- an admin's own chats, a team's memos -- still let
16
+ anybody read, edit or delete a row the table left out, by typing its id. The record is
17
+ now found through `recourse_relation`, and one the relation leaves out is not found. A
18
+ host whose relation filters out records that should still have pages of their own, or
19
+ selects columns a form cannot save back, finds them in a controller of its own.
20
+
21
+ ## 7.11.3 - 2026-10-05
22
+
23
+ * [FIX] A host without Action Cable draws every index
24
+
25
+ Its tables simply do not redraw themselves when a row changes, rather than raising
26
+ `uninitialized constant ActionCable` from the subscription the index used to render.
27
+
10
28
  ## 7.11.2 - 2026-09-26
11
29
 
12
30
  * [FIX] The count in a tab is delimited
data/README.md CHANGED
@@ -14,10 +14,10 @@ gem install recourse
14
14
 
15
15
  ```ruby
16
16
  # Gemfile
17
- gem 'recourse', '~> 7.0'
17
+ gem 'recourse', '~> 8.0'
18
18
  ```
19
19
 
20
- `~> 7.0` follows Semantic Versioning: `bundle update` takes every 7.x and never a
20
+ `~> 8.0` follows Semantic Versioning: `bundle update` takes every 8.x and never a
21
21
  breaking change. Rails 8.1 and Ruby 3.2 are the minimum; the pages need Turbo, which
22
22
  `turbo-rails` brings, and nothing else in the host. Everything a page is styled and
23
23
  scripted by — Bootstrap 6, its icons, Turbo, Stimulus and the controllers behind these
@@ -174,7 +174,7 @@ end
174
174
 
175
175
  A controller the app already defines is left alone, and one line of it is usually
176
176
  enough: `recourse_relation` puts a scope of your own behind a table the gem draws
177
- whole, and `find_resource` finds a singular record the parent names no association for.
177
+ whole, and behind the pages of each record in it, and `find_resource` finds a singular record the parent names no association for.
178
178
 
179
179
  ## Step 5. Enjoy the extras
180
180
 
@@ -4,13 +4,16 @@ module Recourse
4
4
  module ResourceResolution
5
5
  private
6
6
 
7
+ # A record with an id is found among the rows `recourse_relation` lists, so a host
8
+ # that narrows its table narrows the record's own pages with it: a row the table
9
+ # leaves out is not found, rather than read, edited or deleted under that route.
7
10
  # A singular resource is reached with no id — `/places/5/memo` names the record by
8
11
  # the path it hangs off rather than by a key of its own — so it is read off the
9
12
  # parent instead, under the name the route already gives it. Where the parent has
10
13
  # no association of that name the record is still the host's to find, in a
11
14
  # controller of its own.
12
15
  def find_resource
13
- return assign resource_class.find(params.expect(:id)) if params.key? :id
16
+ return assign recourse_relation.find(params.expect(:id)) if params.key? :id
14
17
  return unless singular_reflection
15
18
 
16
19
  record = @recourse_parent.association(singular_reflection.name).reader
@@ -85,8 +85,9 @@ module Recourse
85
85
  @recourse_model.recourse_broadcast if @recourse_model.respond_to? :recourse_broadcast
86
86
  end
87
87
 
88
- # The rows the index lists, before the search, the sort and the page reach them:
89
- # every row of the model, narrowed by the parent a nested route names. The one thing
88
+ # The rows the index lists, before the search, the sort and the page reach them,
89
+ # and the only rows a record's own pages find: every row of the model, narrowed by
90
+ # the parent a nested route names. The one thing
90
91
  # a host overrides to put a scope of its own behind a screen the gem draws whole —
91
92
  # `def recourse_relation = County.with_boosts_for(@recourse_parent)`. Private, so
92
93
  # overriding it adds a query and never an action.
@@ -17,10 +17,11 @@ module Recourse
17
17
  # `broadcasts_refreshes` would send updates and destroys to per-record streams
18
18
  # the index never hears. The ivar dies with the class on a dev reload, so the
19
19
  # next request attaches to the fresh class again. Quiet without turbo-rails and
20
- # Active Job, which is when the model has no `broadcasts_refreshes_to`.
20
+ # Active Job, which is when the model has no `broadcasts_refreshes_to`, and
21
+ # without Action Cable, which the index would subscribe through.
21
22
  def recourse_broadcast
22
23
  return if recourse_broadcasting? || !recourse_broadcasts?
23
- return unless respond_to? :broadcasts_refreshes_to
24
+ return unless respond_to?(:broadcasts_refreshes_to) && defined?(ActionCable)
24
25
 
25
26
  @recourse_broadcasting = true
26
27
  broadcasts_refreshes_to ->(record) { record.model_name.plural }
@@ -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.11.2'
3
+ VERSION = '8.0.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.11.2
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  - !ruby/object:Gem::Version
297
297
  version: '0'
298
298
  requirements: []
299
- rubygems_version: 4.0.3
299
+ rubygems_version: 4.0.20
300
300
  specification_version: 4
301
301
  summary: A routes.rb DSL that mounts ready-made resource screens.
302
302
  test_files: []