18 lines
608 B
Ruby
18 lines
608 B
Ruby
module Merged
|
|
# shared data across engine and app
|
|
# takes a little footwork, as seen below
|
|
class SharedBase < ActiveYaml::Base
|
|
def self.raw_data
|
|
paths = [ Merged::Engine.root.join("config") , Rails.root.join(Merged.data_dir) ]
|
|
loaded_files = paths.collect do |path|
|
|
actual_filename = filename || name.tableize
|
|
full = File.join(path, "#{actual_filename}.#{extension}")
|
|
got = load_path(full)
|
|
raise "#{full} contained #{got.class}, not Array" unless got.class == Array
|
|
got
|
|
end
|
|
loaded_files.first + loaded_files.last
|
|
end
|
|
end
|
|
end
|