Sha256: 3f386791bc04abf4981495853d9a8db4bfd3b79836352e69e0a4a5e8ecf96ba3
Contents?: true
Size: 871 Bytes
Versions: 12
Compression:
Stored size: 871 Bytes
Contents
class RenameQbrickPagesUrlToPath < ActiveRecord::Migration def up I18n.available_locales.each do |locale| rename_column :qbrick_pages, :"url_#{locale.to_s.underscore}", :"path_#{locale.to_s.underscore}" end pages = Qbrick::Page.unscoped.all I18n.available_locales.each do |locale| I18n.with_locale(locale) do pages.each do |page| page.update_attribute :path, page.create_path end end end end def down I18n.available_locales.each do |locale| rename_column :qbrick_pages, :"path_#{locale.to_s.underscore}", :"url_#{locale.to_s.underscore}" end pages = Qbrick::Page.unscoped.all I18n.available_locales.each do |locale| I18n.with_locale(locale) do pages.each do |page| page.update_attribute :url, page.create_path end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems