render_turbo_stream 4.3.10 → 4.3.12
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: 6491dd2f6c65045c5582fb2dd5ea07c3b8f02b3f279c33631f153c014008a068
|
4
|
+
data.tar.gz: 4532b772e1cf4978567853cc9db83d46d15017f934356e92b4dff6bdba1daae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f8f75f1403116b7096ee222f609d646db438d862f06ed076bcd585c37004b8123a1af46fa0b1e43acc5ef95ce9cc87554e5d1b35018fab9126d79c1b4c1b21
|
7
|
+
data.tar.gz: acd8dcd1f6c361128db23f83529568bd010f558e1702536d8547c2ec337f040c4abe7de636ce7ca49e14e7ae8ecdc3e6b98185c117ad62b0ca8ffada55e895af
|
data/README.md
CHANGED
@@ -135,6 +135,15 @@ render_turbo_stream(
|
|
135
135
|
)
|
136
136
|
```
|
137
137
|
|
138
|
+
for just rendering a partial there is a special helper:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
render_partial(
|
142
|
+
'form',
|
143
|
+
locals: {}
|
144
|
+
)
|
145
|
+
```
|
146
|
+
|
138
147
|
this enables:
|
139
148
|
|
140
149
|
- turbo-stream or custom javascript actions from turbo and all actions from [turbo_power](https://github.com/marcoroth/turbo_power)
|
@@ -240,6 +249,10 @@ In order to avoid this kind of tedious coding, the gem has a kind of fallback bu
|
|
240
249
|
3. If all that not is found it raises a exception
|
241
250
|
4. wraps the partial within the `turbo_stream.*` and sends this to the front.
|
242
251
|
|
252
|
+
**Debugging**
|
253
|
+
|
254
|
+
On `:debug` level ([rails-docs](https://guides.rubyonrails.org/v3.2.14/debugging_rails_applications.html#log-levels)), if a save action fails, `turbo_stream_save` and `turbo_channel_save` are logging the output from `Model.errors.full_messages` to the console.
|
255
|
+
|
243
256
|
# Request Testing
|
244
257
|
|
245
258
|
To test if the whole system works together, including javascript actions, so that finally a part reaches the surface, there is **Capybara** system testing. But it is a good practice to **break tests into smaller pieces**. So, there are helpers for **enabling the much faster request tests that are much easier to maintain**.
|
@@ -183,6 +183,10 @@ module RenderTurboStream
|
|
183
183
|
raise libs.action_errors(turbo_actions).join(', ')
|
184
184
|
end
|
185
185
|
|
186
|
+
unless save_action
|
187
|
+
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
188
|
+
end
|
189
|
+
|
186
190
|
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
187
191
|
#== RENDER TO CHANNEL
|
188
192
|
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
@@ -67,6 +67,7 @@ module RenderTurboStream
|
|
67
67
|
|
68
68
|
unless save_action
|
69
69
|
response.status = 422
|
70
|
+
RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
|
70
71
|
end
|
71
72
|
|
72
73
|
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
@@ -170,5 +171,10 @@ module RenderTurboStream
|
|
170
171
|
|
171
172
|
end
|
172
173
|
|
174
|
+
|
175
|
+
def render_partial(partial, id: nil, action: :replace, locals: {})
|
176
|
+
render_turbo_stream([{partial: partial, locals: locals, id: id, action: action}])
|
177
|
+
end
|
178
|
+
|
173
179
|
end
|
174
180
|
end
|
@@ -84,5 +84,16 @@ module RenderTurboStream
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
def self.debug_save_errors(object, controller_action_name)
|
88
|
+
if object.id.present?
|
89
|
+
Rails.logger.debug(" • #{controller_action_name} #{object.class}:#{object.id} FAILED:")
|
90
|
+
else
|
91
|
+
Rails.logger.debug(" • #{controller_action_name} #{object.class} FAILED:")
|
92
|
+
end
|
93
|
+
object.errors.full_messages.each do |e|
|
94
|
+
Rails.logger.debug(" => #{e}")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
87
98
|
end
|
88
99
|
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.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|