Module: Pageflow::ConfigHelper

Included in:
CommonEntrySeedHelper
Defined in:
app/helpers/pageflow/config_helper.rb

Overview

Generate seed data based on configuration objects

Instance Method Summary collapse

Instance Method Details

#config_file_model_types_seed(json, config) ⇒ Object

Render seed data that can be used to map model names in parent_file_model_type attributes to file collection names.

Parameters:

Since:

  • 15.1



25
26
27
28
29
# File 'app/helpers/pageflow/config_helper.rb', line 25

def config_file_model_types_seed(json, config)
  config.file_types.index_by(&:collection_name).each do |collection_name, file_type|
    json.set!(collection_name, file_type.model.name)
  end
end

#config_file_url_templates_seed(json, config) ⇒ Object

Render seed data that can be used to build file urls.

Parameters:

Since:

  • 15.1



9
10
11
12
13
14
15
16
17
# File 'app/helpers/pageflow/config_helper.rb', line 9

def config_file_url_templates_seed(json, config)
  config.file_types.each do |file_type|
    json.set!(file_type.collection_name) do
      file_type.url_templates.call.each do |key, value|
        json.set!(key, value)
      end
    end
  end
end