Sha256: bf9c439bacf7324ef2ef27c17e273e25f7383f8aac9230f254df81af1b59777f

Contents?: true

Size: 502 Bytes

Versions: 1

Compression:

Stored size: 502 Bytes

Contents

class AddNestedSetToPostCategories < ActiveRecord::Migration
  def up
    change_table :spud_post_categories do |t|
      t.integer :lft
      t.integer :rgt
      t.integer :depth
    end

    # Populates lft, rgt, and depth values for nested set
    # SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
    # SpudPostCategory.rebuild!
  end

  def down
    change_table :spud_post_categories do |t|
      t.remove :ltf
      t.remove :rgt
      t.remove :depth
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tb_blog-1.3.0.beta1 db/migrate/20121113135812_add_nested_set_to_post_categories.rb