From a8aa16170a5ae0d16d0233510b622488b65fd10d Mon Sep 17 00:00:00 2001 From: Torsten Date: Thu, 8 Dec 2022 16:34:20 +0200 Subject: [PATCH] fix model specs --- lib/merged.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/merged.rb b/lib/merged.rb index 81afbd9..79f7b88 100644 --- a/lib/merged.rb +++ b/lib/merged.rb @@ -3,4 +3,18 @@ require "merged/engine" module Merged + def self.load_data + ["card_style" , "section_style" , "option"].each do |kind| + # loading egine definitions first, can be overriden + load_from kind , Engine.root.join("config/merged/#{kind}.yaml") + end + Page.load_pages + Image.load_images + end + + def self.load_from( kind , path ) + return unless File.exists?(path) + clazz = "Merged::#{kind.camelcase}".constantize + clazz.load(YAML.load_file( path )) + end end