You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set the URL of the current request (such as when using request-dependent path helpers):
366
417
@@ -418,7 +469,7 @@ To fix this issue, either use the `content` accessor directly or choose a differ
418
469
419
470
### `ControllerCalledBeforeRenderError`
420
471
421
-
`#controller` can't be used during initialization, as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
472
+
`#controller` can't be used before rendering, as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
422
473
423
474
It's sometimes possible to fix this issue by moving code dependent on `#controller` to a [`#before_render` method](https://viewcomponent.org/api.html#before_render--void).
424
475
@@ -444,7 +495,7 @@ See [the collections docs](https://viewcomponent.org/guide/collections.html) for
444
495
445
496
### `HelpersCalledBeforeRenderError`
446
497
447
-
`#helpers` can't be used during initialization as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
498
+
`#helpers` can't be used before rendering as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
448
499
449
500
It's sometimes possible to fix this issue by moving code dependent on `#helpers` to a [`#before_render` method](https://viewcomponent.org/api.html#before_render--void).
450
501
@@ -528,7 +579,7 @@ ViewComponent SystemTest controller must only be called in a test environment fo
528
579
529
580
### `TranslateCalledBeforeRenderError`
530
581
531
-
`#translate` can't be used during initialization as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
582
+
`#translate` can't be used before rendering as it depends on the view context that only exists once a ViewComponent is passed to the Rails render pipeline.
532
583
533
584
It's sometimes possible to fix this issue by moving code dependent on `#translate` to a [`#before_render` method](https://viewcomponent.org/api.html#before_render--void).
Copy file name to clipboardExpand all lines: docs/guide/templates.md
+7-3
Original file line number
Diff line number
Diff line change
@@ -181,14 +181,18 @@ end
181
181
182
182
Code editors commonly add a trailing newline character to source files in keeping with the Unix standard. Including trailing whitespace in component templates can result in unwanted whitespace in the HTML, eg. if the component is rendered before the period at the end of a sentence.
183
183
184
-
To strip trailing whitespace from component templates, use the `strip_trailing_whitespace`class method.
184
+
To strip trailing whitespace from component templates, use the `strip_trailing_whitespace`component-local config option.
0 commit comments