Skip to content

Commit fe457d3

Browse files
committed
Eager load all block subclasses in dev
Allows rendering available block types in page block editor. Classes are already eager-loaded in prod.
1 parent 9633029 commit fe457d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/controllers/better_together/pages_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ module BetterTogether
55
class PagesController < FriendlyResourceController
66
before_action :set_page, only: %i[show edit update destroy]
77

8+
before_action only: %i[new edit], if: -> { Rails.env.development? } do
9+
# Make sure that all BLock subclasses are loaded in dev to generate new block buttons
10+
BetterTogether::Content::Block.load_all_subclasses
11+
end
12+
813
def index
914
authorize resource_class
1015
@pages = policy_scope(resource_class.with_translations)

0 commit comments

Comments
 (0)