Skip to content

Commit 941da31

Browse files
committed
Default preview controller should not crash with config.action_controller.include_all_helpers = false (fixes #1654)
1 parent 3376533 commit 941da31

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/controllers/concerns/view_component/preview_actions.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ module PreviewActions
1414

1515
# Including helpers here ensures that we're loading the
1616
# latest version of helpers if code-reloading is enabled
17-
helper :all if include_all_helpers
17+
if include_all_helpers
18+
helper :all
19+
else
20+
# Always provide the #view_source helper
21+
helper PreviewHelper
22+
end
1823
end
1924

2025
def index

docs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ nav_order: 5
2626

2727
*Reegan Viljoen*
2828

29+
* Fix a bug where component previews would crash with "undefined local variable or method `preview_source'"
30+
31+
*Henning Koch*
32+
33+
2934
## 3.12.1
3035

3136
* Ensure content is rendered correctly for forwarded slots.

0 commit comments

Comments
 (0)