From 3bd6e525dfa3e801f6510e0ae103cc034175dc12 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Thu, 2 Jun 2022 21:46:54 +0200 Subject: [PATCH] load --- app/models/communication/block/template/base.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/communication/block/template/base.rb b/app/models/communication/block/template/base.rb index 6886f6842..1aa7ca17d 100644 --- a/app/models/communication/block/template/base.rb +++ b/app/models/communication/block/template/base.rb @@ -35,10 +35,12 @@ class Communication::Block::Template::Base end def #{property} + load_data #{property}_component.data end def #{property}=(value) + load_data #{property}_component.data = value end @@ -47,6 +49,7 @@ class Communication::Block::Template::Base def initialize(block) @block = block + @data_loaded = false end def data=(value) @@ -92,6 +95,13 @@ class Communication::Block::Template::Base } end + def load_data + return if @data_loaded + # Accessing the data loads it from database + block.data + @data_loaded = true + end + def build_git_dependencies end -- GitLab