Sha256: 4cd10d5d86e4f2ef7d19223b376970627cc09c85eb7dbb986c6565905df67bad
Contents?: true
Size: 858 Bytes
Versions: 48
Compression:
Stored size: 858 Bytes
Contents
# This migration comes from dm_cms (originally 20140328205246) class AddPagesRankedModel < ActiveRecord::Migration def up add_column :cms_pages, :row_order, :integer rename_column :cms_contentitems, :position, :row_order #--- because of some duplications in the position column, need to # create a more unique position value. So add up the positions total = 0 CmsPage.unscoped.order(:ancestry, :position).each do |page| total = total + page.position Account.current = Account.find(page.account_id) page.update_attributes :row_order => total end remove_column :cms_pages, :position end def down remove_column :cms_pages, :row_order add_columnn :cms_pages, :position, :integer rename_column :cms_contentitems, :row_order, :position end end
Version data entries
48 entries across 48 versions & 3 rubygems