render_turbo_stream 4.3.13 → 4.3.14
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: a7cdf1b3f0af6bf441e0c0d08919985aaa0a83ef49671724860cdb8e6ff45521
|
4
|
+
data.tar.gz: 23e55905c875439a1203a970fca7a9f72bde401de75d886849ed604213d05db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bfed3d855085bbd4834b5cce5fa13351e3fac306082172b8cc78525c677515b66de762b2291b08c2c25321e5b7c2e52e245560e465e27bb8ff5154029307189
|
7
|
+
data.tar.gz: d7d0257d9b7210c5f1516cd7fee00765942d6222b32e4ec9338d4c2f452e2ffcce432a7242208045acd7c49fcffedcbdfe7ccabb979fb1b51c7da843fdc5b9db
|
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,11 @@ 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
|
+
session['last_saved_object'] = object.to_global_id
|
189
|
+
end
|
190
|
+
else
|
187
191
|
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
188
192
|
end
|
189
193
|
|
@@ -65,7 +65,11 @@ 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
|
+
session['last_saved_object'] = object.to_global_id
|
71
|
+
end
|
72
|
+
else
|
69
73
|
response.status = 422
|
70
74
|
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
71
75
|
end
|
@@ -171,9 +175,8 @@ module RenderTurboStream
|
|
171
175
|
|
172
176
|
end
|
173
177
|
|
174
|
-
|
175
178
|
def stream_partial(partial, id: nil, action: :replace, locals: {})
|
176
|
-
render_turbo_stream([{partial: partial, locals: locals, id: id, action: action}])
|
179
|
+
render_turbo_stream([{ partial: partial, locals: locals, id: id, action: action }])
|
177
180
|
end
|
178
181
|
|
179
182
|
end
|