Sha256: 874697f11c82e3f511882e15f378eccc4ca49cb126d9a58096432d2dfa954307
Contents?: true
Size: 980 Bytes
Versions: 14
Compression:
Stored size: 980 Bytes
Contents
# frozen_string_literal: true class FixProposalsData < ActiveRecord::Migration[5.2] def up reset_column_information PaperTrail.request(enabled: false) do Decidim::Proposals::Proposal.find_each do |proposal| next if proposal.title.is_a?(Hash) && proposal.body.is_a?(Hash) author = proposal.coauthorships.first.author locale = author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence proposal.title = { locale => proposal.title } proposal.body = { locale => proposal.body } proposal.save! end end reset_column_information end def down; end def reset_column_information Decidim::User.reset_column_information Decidim::Coauthorship.reset_column_information Decidim::Proposals::Proposal.reset_column_information Decidim::Organization.reset_column_information end end
Version data entries
14 entries across 14 versions & 1 rubygems