0
进展:轨HAS_ONE创建错误
#== Schema Information
#
# Table name: progresses
#
# id :integer not null, primary key
# width :integer default(0)
# course_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Progress < ActiveRecord::Base
has_many:progress_comments
belongs_to:course
end
课程:
# == Schema Information
#
# Table name: courses
#
# id :integer not null, primary key
# courseName :string(50) not null
# place :string(100) not null
# startTime :datetime default(2012-02-10 00:39:52 UTC)
# endTime :datetime
# teacher :string(20) default("nil_teacher")
# reason :text not null
# upNum :integer default(0)
# downNum :integer default(0)
# day :integer not null
# school_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Course < ActiveRecord::Base
#attr_acessssible:
#validates :courseName, presence: true
has_many:remarks
has_many:reviews
has_one:progress
has_and_belongs_to_many:course_catagories
belongs_to:school
end
,而我想创建由
Course.first.progress.create(...)
它出现在铁轨控制台进度:
undefined method 'create' for nil:NilClass
任何人得到一些想法?谢谢