Created
September 27, 2017 10:23
-
-
Save beagleknight/5e7a4986c3fcfa6fd0b40991e89bef19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MigrateTemplateTextsToSettings < ActiveRecord::Migration[5.1] | |
class Feature < ApplicationRecord | |
self.table_name = :decidim_features | |
end | |
def up | |
template_texts = execute "SELECT * from decidim_accountability_template_texts" | |
template_texts.each do |template_text| | |
feature = Feature.find(template_text["decidim_feature_id"]) | |
feature.settings["global"].merge!( | |
intro: template_text["intro"], | |
categories_label: template_text["categories_label"], | |
subcategories_label: template_text["subcategories_label"], | |
heading_parent_level_results: template_text["heading_parent_level_results"], | |
heading_leaf_level_results: template_text["heading_leaf_level_results"] | |
) | |
feature.save! | |
end | |
drop_table :decidim_accountability_template_texts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment