1
I’m having a hard time using Gem Acestry in so far as 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:in
change' C:in
migrate' Tasks: TOP => db:migrate (See full trace by running task with --trace)
Follow the code of migrates:
class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.string :name
t.timestamps
end
end
end
And
class AddAncestryToCategory < ActiveRecord::Migration
def change
add_column :categories, :ancestry, :string
add_index :category, :ancestry
end
end