我正在为Equipment和Instructors创建一个名为EquipmentOwnership的连接表。
class EquipmentOwnership < ActiveRecord::Base
attr_accessible :equipment_id, :instructor_id, :owned
belongs_to :equipment
belongs_to :instructor
end
它在我的架构中显示如下:
create_table "equiment_ownerships", :force => true do |t|
t.integer "equipment_id"
t.integer "instructor_id"
t.boolean "owned"
end
但是,这是rails控制台中发生的事情:
[1] pry(main)> EquipmentOwnership
=> EquipmentOwnership(Table doesn't exist)
可能的原因是什么?
我正在使用Postgres,rails 3.2,ruby 1.9.3p194和OSX Mountain lion。
答案 0 :(得分:2)
create_table "equiment_ownerships"
缺少p
。所以,应该是:
create_table "equipment_ownerships"