render_turbo_stream 4.3.13 → 4.3.15
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 134824095a6baf570e7a0702b435773c623cae537059ee6883dc141cb9a15237
|
4
|
+
data.tar.gz: 31aba69f008b047d5ab1234f621b3bc5d1858c8808fb644bb2d59eaf63766b19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cc9bc72db795c128ede596635e5a9b303033e58d2b6f791767eb3d3d1c720ab23e307dcd0cf2b9a41667a24f33ca4d8509e3594854a14cd456b56de539ddbd4
|
7
|
+
data.tar.gz: 3dd2fe010267ee08a0f1b82f350310a4b6dc53e5c5e93912d464b3f4420787e2c2cf93ddb684221540a4b49a6ed87604f9eb766d1a42ce5428aed9508db3e9a4
|
data/README.md
CHANGED
@@ -17,8 +17,6 @@ Has a testing strategy.
|
|
17
17
|
An overview of how we design a rails-7 application with turbo
|
18
18
|
is [published on dev.to](https://dev.to/chmich/rails-7-vite-wrapping-up-1pia).
|
19
19
|
|
20
|
-
Hope it helps :)
|
21
|
-
|
22
20
|
**Chris**
|
23
21
|
|
24
22
|
## Installation
|
@@ -45,7 +43,7 @@ Create a Initializer
|
|
45
43
|
ActionView::Base.send :include, RenderTurboStream::ViewHelpers
|
46
44
|
```
|
47
45
|
|
48
|
-
spec/rails_helper.rb (
|
46
|
+
spec/rails_helper.rb (for rspec)
|
49
47
|
|
50
48
|
```ruby
|
51
49
|
RSpec.configure do |config|
|
@@ -67,6 +65,10 @@ Required Configurations for Flash Partial
|
|
67
65
|
|
68
66
|
# In case of redirection a flash cannot be sent by TurboStream
|
69
67
|
config.x.render_turbo_stream.allow_channel_to_me_for_turbo_stream_save = true
|
68
|
+
|
69
|
+
config.x.render_turbo_stream.store_last_saved_object = true # default: false
|
70
|
+
# saves the last successful saved record into session['last_saved_object'] as global_id
|
71
|
+
# this can be accessed by view_helper #last_saved_object
|
70
72
|
```
|
71
73
|
|
72
74
|
For the latter you have to setup channels, see below.
|
@@ -183,7 +183,15 @@ module RenderTurboStream
|
|
183
183
|
raise libs.action_errors(turbo_actions).join(', ')
|
184
184
|
end
|
185
185
|
|
186
|
-
|
186
|
+
if save_action
|
187
|
+
if Rails.configuration.x.store_last_saved_object && object.id
|
188
|
+
begin
|
189
|
+
session['last_saved_object'] = object.to_global_id
|
190
|
+
rescue
|
191
|
+
Rails.logger.debug("session['last_saved_object'] = ... failed. You may be in test environent?")
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else
|
187
195
|
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
188
196
|
end
|
189
197
|
|
@@ -65,7 +65,15 @@ module RenderTurboStream
|
|
65
65
|
raise libs.action_errors(streams).join(', ')
|
66
66
|
end
|
67
67
|
|
68
|
-
|
68
|
+
if save_action
|
69
|
+
if Rails.configuration.x.store_last_saved_object && object.id
|
70
|
+
begin
|
71
|
+
session['last_saved_object'] = object.to_global_id
|
72
|
+
rescue
|
73
|
+
Rails.logger.debug("session['last_saved_object'] = ... failed. You may be in test environent?")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
else
|
69
77
|
response.status = 422
|
70
78
|
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
71
79
|
end
|
@@ -171,9 +179,8 @@ module RenderTurboStream
|
|
171
179
|
|
172
180
|
end
|
173
181
|
|
174
|
-
|
175
182
|
def stream_partial(partial, id: nil, action: :replace, locals: {})
|
176
|
-
render_turbo_stream([{partial: partial, locals: locals, id: id, action: action}])
|
183
|
+
render_turbo_stream([{ partial: partial, locals: locals, id: id, action: action }])
|
177
184
|
end
|
178
185
|
|
179
186
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_turbo_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|