Hello
Has anyone tried to use the has_many_polymorphs plugin? I have added
the following line into environment.rb just before
Rails::Initializer.run:
require ‘has_many_polymorphs’
… created two models:
class CreateOwnerships < ActiveRecord::Migration
def self.up
create_table :ownerships do |t|
t.references :owner, :polymorphic => true
t.references :property, :polymorphic => true
t.column :created_on, :timestamp
end
end
def self.down
drop_table :ownerships
end
end
class CreateTasks < ActiveRecord::Migration
def self.up
create_table :tasks do |t|
t.column :name, :string, :null => false
t.column :description, :text
t.column :complete, :boolean, :null => false
t.column :weight, :float, :null => false
end
end
def self.down
drop_table :tasks
end
end
and tried to run rake db:migrate
and got the following message:
** has_many_polymorphs: rails environment detected
** has_many_polymorphs: preloading parent model Ownership
** has_many_polymorphs: Ownership could not be preloaded:
#<ActiveRecord::StatementInvalid: Mysql::Error: Table
‘mydb.ownerships’ doesn’t exist: SHOW FIELDS FROM ownerships>
rake aborted!
what’s wrong?
Thanks