伙计们,当我按照http://guides.rubyonrails.org/testing.html,上面写着:
test_the_truth(ClassroomTypeTest): ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column type in field list : INSERT INTO
classroom_types
(type
,memo
,created_at
,updated_at
,id
) VALUES ( MyString , MyString , 2011-05-31 08:40:54 , 2011-05-31 08:40:54 , 980190962)
I am confused, I do not have a column in my classroom_types table,why will it appear such an error? Can anyone help me? Many Thanks!
以下是我的模型和关系:
ClassroomType型号:
class ClassroomType < ActiveRecord::Base
has_many :classrooms
end
课堂模式:
class Classroom < ActiveRecord::Base
belongs_to :classroom_type
belongs_to :teaching_building
end
教学楼模型:
class TeachingBuilding < ActiveRecord::Base
has_many :classrooms
end
以下是相应的表格:
教室:
- id
- classroom_no
- classroom_name
- classroom_type_id
- teaching_building_id
教室类型(_T):
- id
- name
- memo
教学_建筑:
- id
- t_no
- name