I'm having trouble using the gem Acestry in the part where it says:
Add index to migration: add_index [table],: ancestry (UP) / remove_index [table],: ancestry
I'm creating a method called Category
and trying to add Acestry but the following error appears in PowerShell:
== AddAncestryToCategory: migrating ========================================================== - add_column (: categories,: ancestry,: string) - > 0.0140s - add_index (: category,: ancestry) rake aborted! An error has occurred, this and all later migrations canceled:
SQLite3 :: SQLException: no such table: main.category: CREATE INDEX "index_category_on_ancestry" ON "category" ("ancestry ") C: /Sites/projects/mymoney/db/migrate/20140205153511_add_ancestry_to_category.rb: 4: inchange' C:in
migrate ' Tasks: TOP = > db: migrate (See full trace by running task with --trace)
Follow the migration code:
class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.string :name
t.timestamps
end
end
end
E
class AddAncestryToCategory < ActiveRecord::Migration
def change
add_column :categories, :ancestry, :string
add_index :category, :ancestry
end
end